Xojo Conferences

DynaPDF Manual - Page 520

Previous Page 519   Index   Next Page 521

Function Reference
Page 520 of 766
void* pdfNewPDF(void)
The function creates a new PDF instance and returns the pointer of it. If there is no sufficient
memory to create the PDF instance the return value is NULL.
To improve processing speed one PDF instance should be used as long as possible. A PDF instance
holds a few important data structures like the font cache and CMap cache. Rebuilding these caches is
a relatively expensive operation and this should be avoided if not necessary. Using the same PDF
instance to create as many PDF files as possible can significantly improve processing speed.
Multiple instances can be used at the same time. However, DynaPDF supports callback functions for
many purposes such as the error handling, content parsing, or to increment a progress bar and so on.
Each PDF instance must use its own copy of a callback function because callback functions cannot be
shared among multiple instances. This is especially important when the application should be
If a PDF instance is no longer needed then it must be deleted with DeletePDF().
This function is automatically called in the wrapper classes for Visual Basic, Visual Basic .Net, C#,
and Delphi. There is no need to create PDF instances manually when using these programming
C or C++ developers must create a PDF instance before a DynaPDF function can be executed.
SI32 pdfOpenImportBuffer(
const PPDF* IPDF,
// Instance pointer
const void* Buffer,
// Pointer to PDF file
UI32 BufSize,
// Buffer length in bytes
TPwdType PwdType,
// Kind of password and flags (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
// If set, the buffer is not copied
The function opens an external PDF file like OpenImportFile() but accepts a file buffer as input.

Previous topic: MultiplyMatrix

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