SavePageRangeTextToFile

Text and extraction

Description

Creates a UTF-8 text file from a parsed page range using incremental page writes

Output is generated in a temporary file beside the destination and replaces it only after the complete export succeeds; invalid page selections, cancellation, generation failures, and publication failures preserve an existing destination

Syntax

Function TPDFlib.SavePageRangeTextToFile(Const PageRange: WideString; ExtractOptions: Integer; Const PageSeparator, FileName: WideString): Integer;

Parameters

PageRangeOne-based page-range expression such as 1-3,7; an empty value selects every page
ExtractOptionsText extraction option from 0 to 11, as documented for GetPageText; values outside that range reject the call
PageSeparatorText inserted between consecutive pages and encoded as UTF-8; empty writes pages back to back
FileNameDestination path, replaced only after the complete export succeeds

Return values

Returns the number of pages written, or zero when the output cannot be created or the request is invalid

Remarks

The destination file is replaced and the previously selected PDF page is restored

See also

ExtractPageRangeText, SavePageRangeTextToStream