ExportDocumentMarkdown

Text, extraction, Markdown

Description

Exports a selected PDF page range into one semantic Markdown string suitable for search indexing, knowledge bases, and language-model ingestion

Syntax

Delphi

Function TPDFlib.ExportDocumentMarkdown(Const PageRange: WideString;
  Options: Integer): WideString;

ActiveX

Function PDFlib::ExportDocumentMarkdown(PageRange As String,
  Options As Long) As String

DLL

const wchar_t* DLExportDocumentMarkdown(int InstanceID,
  const wchar_t* PageRange, int Options);
const char* DLExportDocumentMarkdownA(int InstanceID,
  const char* PageRange, int Options);

Parameters

PageRangeA one-based range such as 1-3,7, or an empty string for every page; explicit page order is preserved
OptionsThe option mask documented by ExportPageMarkdown

Return values

Returns the combined Markdown text, or an empty string when validation, cancellation, or extraction fails

Remarks

Analysis uses SetStructuredTextOptions independently of the format-specific Options; inspect GetLastStructuredTextDiagnostics for reading sources and fallback warnings

Real tag-tree order takes precedence when content bindings are complete; unresolved or ambiguous content keeps extracted text in mixed or geometric fallback, and unknown custom roles are not guessed from their names

Document-wide analysis can join table fragments across consecutive source pages and identify repeated margin furniture; default furniture detection preserves the text

Merged or continued tables use a single embedded HTML table, keep empty cells and omit identified repeated continuation headers

With page markers enabled, pages normally start with <!-- page: N -->; a continued table omits markers inside the open HTML table

Explicit page order is preserved; reversed or non-consecutive page selections are not forcibly joined

Selected page models and the complete Markdown result are buffered for document-wide analysis; the stream and file APIs also retain this analysis model and output buffers

Extraction preserves the selected page and open writer tag stack; current unsaved writer tags are included without closing tags or finalising the document

Progress and cooperative cancellation use the normal document operation lifecycle

LastErrorCode is 113 for an invalid range or option mask and 517 when extraction fails

See also

ExportPageMarkdown, SaveMarkdownToStream, ExtractStructuredDocument