DACopyFile
Document management, Direct access functionality
Description
Opens the input PDF through the Direct Access reader in read-only mode to determine the page count, closes the handle, and then copies the source bytes unchanged to the output file.
This function is intended for workflows that need a page count and a file-to-file copy without using the normal LoadFromFile object graph or rewriting the document through DASaveAsFile. It does not apply Direct Access edits. Use DAOpenFile or DAOpenFileReadOnly with DASaveAsFile when a modified document must be fully rewritten.
Syntax
Delphi
function TPDFlib.DACopyFile(const InputFileName, OutputFileName: WideString; out PageCount: Integer): Integer; overload;function TPDFlib.DACopyFile(const InputFileName, OutputFileName: WideString): Integer; overload;Parameters
| InputFileName | The path and name of the source PDF document. |
|---|---|
| OutputFileName | The path and name of the copied PDF document to create. The input file cannot be overwritten. |
| PageCount | Receives the number of pages found by the Direct Access reader before the file is copied. |
Return values
| 0 | The source could not be opened, the input and output paths refer to the same file, or the output copy could not be created. Check LastErrorCode for the underlying error. |
|---|---|
| 1 | The page count was read and the file was copied successfully. |