Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

DynaPDF Manual - Page 511

Previous Page 510   Index   Next Page 512

Function Reference
Page 511 of 750
Since memory based PDF files have no file name, an existing instance can only be re-opened with
ReOpenImportFile(). The function requires the file handle that OpenImportBuffer() returned. To
reduce the memory usage, memory based PDF files should be closed as soon as possible. A specific
file instance can be closed with CloseImportFileEx().
The flag ptForceRepair can be used to explicitely load a PDF file in repair mode. The usage of is
described at OpenImportFile().
Return values:
If the function succeeds the return value is zero or the file handle if the flag if2UseProxy is set (a
value greater or equal zero). If the function fails the return value is a negative error code. See also
SI32 pdfOpenImportFile(
const PPDF* IPDF,
// Instance pointer
const char* FileName, // File path to PDF file
TPwdType PwdType,
// Kind of password see below
const char* Password) // Password to decrypt the file
typedef enum
= 0, // Open password
= 1, // Owner password
ptForceRepair = 2, // See description below
ptDontCopyBuf = 4
// Not meaningful with OpenImportFile()
The function opens an external PDF file so that it can be imported entirely or parts of it. After a PDF
file was opened, properties of it can be derived by several functions such as GetInDocInfo(),
GetInPageCount() and so on. To import specific pages from the file use the functions ImportPage() or
ImportPageEx(). The entire PDF file can be imported with the function ImportPDFFile() (see example
The parameter PwdType specifies the kind of password that is supplied to the function to decrypt a
PDF file if necessary. If the file is not encrypted the parameter Password is ignored.
It is not required to close a PDF file explicitly before another one can be opened. However, if the file
is no longer needed then it should be closed with CloseImportFile().
Recommended settings to split PDF files
To improve processing speed when splitting large PDF files into smaller pieces, one or more PDF
files can be loaded permanent into memory. In this case the PDF files are not automatically closed
when CloseFile() or FreePDF() is called. In order to load a PDF file permanent into memory set the
property SetUseGlobalImpFiles() to true.

Previous topic: How to keep multiple memory based PDF files open?

Next topic: Editing encrypted PDF files