API referenceCore SDK

pdfGetErrLogMessage

Read one entry from the accumulating indexed error log.

CategoryError 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

C
BOOL32 __stdcall pdfGetErrLogMessage(PPDF IPDF, uint32_t Index, TPDFError* Err);
Delphi
function pdfGetErrLogMessage(const IPDF: PPDF; Index: Cardinal; var Err: TPDFError): LongBool; stdcall; external 'LumasPdf.dll';

TPDFError (from Lumas.Pdf.Types):

Delphi
TPDFError = record
  StructSize: Cardinal;
  Msg:        PAnsiChar;
  ObjNum:     Integer;
  Offset:     Integer;
  SrcFile:    PAnsiChar;
  SrcLine:    Cardinal;
  ErrCode:    Integer;
  ErrType:    Integer;
end;

Parameters

ParameterTypeDescription
IPDFPPDFInstance handle.
Indexuint32_tZero-based entry index; must be < pdfGetErrLogMessageCount.
ErrTPDFError*Receives the entry.

Return valueTRUE when the entry was filled; FALSE on an invalid handle or out-of-range index.

Memory & buffersErr.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)

Delphi
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 alsopdfGetErrLogMessageCount, pdfSetMaxErrLogMsgCount

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
[return: MarshalAs(UnmanagedType.Bool)]
Area
Core SDK
Category

Getters

Exported names

pdfGetErrLogMessage

String variants

The …A form takes UTF-8, …W takes UTF-16; a bare name aliases the ANSI form.

See working code

Worked examples — complete programs in ten languages.