SaveMarkdownToStream

Text, extraction, Markdown, streams

Description

Writes semantic Markdown for a PDF page range directly to a stream as UTF-8

Syntax

Function TPDFlib.SaveMarkdownToStream(Const PageRange: WideString;
  Options: Integer; Target: TStream): Integer;

Parameters

PageRangeA one-based range, or an empty string for every page; explicit page order is preserved
OptionsThe option mask documented by ExportPageMarkdown
TargetThe destination stream; output begins at its current position

Return values

Returns the number of pages written, or zero when validation, cancellation, extraction, or writing fails

Remarks

Output has no UTF-8 byte-order mark and starts at the target stream's current position

The document-wide model and complete Markdown and encoded UTF-8 buffers are assembled before writing; memory grows with the selected content and output size

Reading order, furniture, merged cells and continued tables follow ExportDocumentMarkdown and SetStructuredTextOptions

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

This native TStream API is not exposed through DLL or ActiveX

LastErrorCode is 113 for invalid arguments and 517 for extraction or stream failures

See also

SaveMarkdownToFile, ExportDocumentMarkdown, SavePageRangeTextToStream