API referenceCore SDK

pdfParseContent

Replay the current page's content stream through a table of

Exported namespdfParseContent
Calling conventionstdcall
Thread safetyOne PPDF/handle per thread; see V18 §Threading
IntroducedLumasPDF 1.0

Purpose — Replay the current page's content stream through a table of caller-supplied callback functions, one call per operator.

Description — Parses the active page (when the document holds no authored page — an import-only document — page 1 of the import source is parsed instead, with its content streams decoded first, the same fallback pdfExtractText uses) and dispatches every content operator to the matching callback in Stack: path construction (MoveTo, LineTo, the three BezierTo forms, Rectangle, ClosePath, ClipPath), graphics state (SaveGraphicState/RestoreGraphicState — the full state including the text-state parameters, per ISO 32000 — MulMatrix, SetLineWidth and the other state setters), font selection (SetFont, delivered with the resolved font's name, style, size and embedding state) and text showing.

Text arrives through ShowTextArrayW/ShowTextArrayA as per-record arrays: the W form carries text decoded to Unicode (imported fonts are decoded through their own /ToUnicode maps, two-byte encodings included) together with per-record kerning and advance widths in text space; the text matrix advances record by record. Coordinates handed to the path callbacks are already multiplied through the current transformation matrix. Do operators recurse into the page's Form XObjects (depth-limited to guard against cyclic form references).

Only callbacks the caller assigned are invoked — unused slots may be NULL; every non-NULL slot is validated as a readable pointer before parsing begins.

Declarations

C
BOOL32 __stdcall pdfParseContent(PPDF IPDF, void* Data, TPDFParseInterface* Stack, int32_t Flags);
Delphi
function pdfParseContent(const IPDF: PPDF; const Data: Pointer; var Stack: TPDFParseInterface; Flags: Integer): LongBool; stdcall; external 'LumasPdf.dll';

Parameters

ParameterTypeIn/OutDescription
IPDFPPDFinInstance handle with an open or imported document.
DataPointerinCaller context, passed unchanged as the first argument of every callback.
StackTPDFParseInterfaceinThe callback table (41 slots); assign the callbacks you need and zero the rest.
FlagsIntegerinCompatibility parameter — accepted but unused.

Return valueTRUE once the page has been replayed; FALSE when the instance handle is invalid, a non-NULL callback slot is not a readable pointer, or the page's content cannot be read.

Remarks — For finding, replacing or deleting content rather than observing it, the psr* content-parser surface (psrParsePage) offers an editable object model of the same content; pdfParseContent is the streaming, callback-driven view.

C# (P/Invoke)

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

Core

Exported names

pdfParseContent

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.