SavePageRangeTextToFile

Text and extraction

Description

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

Output goes to a temporary file alongside the destination, which is only replaced once the whole export has succeeded; invalid page selections, cancellation, generation failures and publication failures all leave an existing destination untouched

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