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

Each page is extracted, encoded, and written before the next page is built, so memory follows the most complex selected page rather than total output size

The selected page is restored before the call returns

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

See also

SaveMarkdownToFile, ExportDocumentMarkdown, SavePageRangeTextToStream