pdfGetErrLogMessage
Read one entry from the accumulating indexed error log.
| Category | Error handling |
|---|
Purpose — Read one entry from the accumulating indexed error log.
Description — Fills a TPDFError record for the entry at Index (0 .. count-1). The engine populates Msg, ErrCode, and ErrType from the stored log arrays; ObjNum, Offset, SrcFile (nil), and SrcLine are set to zero — this engine does not retain source-position metadata per entry, and StructSize is not written by this call, so zero-initialise the record before calling if you inspect that field.
Declarations
BOOL32 __stdcall pdfGetErrLogMessage(PPDF IPDF, uint32_t Index, TPDFError* Err);
function pdfGetErrLogMessage(const IPDF: PPDF; Index: Cardinal; var Err: TPDFError): LongBool; stdcall; external 'LumasPdf.dll';
TPDFError (from Lumas.Pdf.Types):
TPDFError = record
StructSize: Cardinal;
Msg: PAnsiChar;
ObjNum: Integer;
Offset: Integer;
SrcFile: PAnsiChar;
SrcLine: Cardinal;
ErrCode: Integer;
ErrType: Integer;
end;
Parameters
| Parameter | Type | Description |
|---|---|---|
IPDF | PPDF | Instance handle. |
Index | uint32_t | Zero-based entry index; must be < pdfGetErrLogMessageCount. |
Err | TPDFError* | Receives the entry. |
Return value — TRUE when the entry was filled; FALSE on an invalid handle or out-of-range index.
Memory & buffers — Err.Msg points into the instance's log buffer and is valid until the next pdfGetErrLogMessage call on the same handle (the return buffer is reused) or the instance is deleted. Copy the text if you keep it while iterating.
Remarks — Because the message buffer is reused per call, materialise each message (e.g. copy to a Delphi string) inside the loop body before the next iteration.
Example — Delphi (production)
var i, n: Integer; e: TPDFError;
begin
n := pdfGetErrLogMessageCount(P);
for i := 0 to n - 1 do
begin
FillChar(e, SizeOf(e), 0);
if pdfGetErrLogMessage(P, Cardinal(i), e) then
Writeln(Format('#%d code=%d type=%d %s',
[i, e.ErrCode, e.ErrType, string(AnsiString(e.Msg))]));
end;
end;
See also — pdfGetErrLogMessageCount, pdfSetMaxErrLogMsgCount
C# (P/Invoke)
[return: MarshalAs(UnmanagedType.Bool)]
Getters
pdfGetErrLogMessage
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.