ExportPageMarkdown

Text, extraction, Markdown

Description

Exports one PDF page as semantic Markdown using the page's detected paragraphs, lists, headings, and tables

Syntax

Delphi

Function TPDFlib.ExportPageMarkdown(Page, Options: Integer): WideString;

ActiveX

Function PDFlib::ExportPageMarkdown(Page As Long, Options As Long) As String

DLL

const wchar_t* DLExportPageMarkdown(int InstanceID, int Page, int Options);
const char* DLExportPageMarkdownA(int InstanceID, int Page, int Options);

Parameters

PageThe one-based page number
OptionsCombine PDF_MARKDOWN_INCLUDE_PAGE_MARKERS (1), PDF_MARKDOWN_DETECT_HEADINGS (2), and PDF_MARKDOWN_PRESERVE_STYLES (4), or use PDF_MARKDOWN_DEFAULT (7); zero emits semantic blocks without optional markers, heading inference, or font styling

Return values

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

Remarks

Heading inference compares short single-line paragraphs with the page's median body text size and produces levels H1 through H3

Font styling recognizes bold and italic font names plus superscript and subscript alignment when PDF_MARKDOWN_PRESERVE_STYLES is enabled

Markdown syntax characters are escaped and table cells escape embedded pipe characters

The selected page is restored before the call returns

DLL return pointers remain valid until the next string-returning call on the same instance

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

See also

ExportDocumentMarkdown, ExtractStructuredPage, ExportPageHTML