DynaPDF Manual - Page 561
Previous Page 560 Index Next Page 562

Function Reference
Page 561 of 821
PDF file (the flag can be set with SetImportFlags2()). The flag reduces also the memory usage and
should normally be set by default.
Be careful with the flag ptDontCopyBuf when loading more than one PDF file into memory. Do not
delete the buffer before all required parts of the PDF file were imported!
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().
Remarks:
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
OpenImportFile().
OpenImportFile
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
{
ptOpen
= 0, // Open password
ptOwner
= 1, // Owner password
ptForceRepair = 2, // See description below
ptDontCopyBuf = 4
// Not meaningful with OpenImportFile()
}TPwdType;
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 below).
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().
Previous topic: OpenImportBuffer, How to keep multiple memory based PDF files open?
Next topic: Recommended settings to split PDF files, How to keep multiple PDF files open?