Xojo Conferences
MBSOct2019CologneDE

DynaPDF Manual - Page 521

Previous Page 520   Index   Next Page 522

Function Reference
Page 521 of 767
NewPDF
Syntax:
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
thread-safe.
If a PDF instance is no longer needed then it must be deleted with DeletePDF().
Remarks:
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
languages.
C or C++ developers must create a PDF instance before a DynaPDF function can be executed.
OpenImportBuffer
Syntax:
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
{
ptOpen
= 0, // Open password
ptOwner
= 1, // Owner password
ptForceRepair = 2, // See description below
ptDontCopyBuf = 4
// If set, the buffer is not copied
}TPwdType;
The function opens an external PDF file like OpenImportFile() but accepts a file buffer as input.
 

Previous topic: OpenImportBuffer

Next topic: How to keep multiple PDF files open?