DynaPDF Manual - Page 573

Previous Page 572   Index   Next Page 574

Function Reference
Page 573 of 839
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 such as the font cache and CMap cache. Rebuilding these
caches is an expensive operation and should be avoided if not necessary. Using the same PDF
instance to create as many PDF files as possible can significantly improve processing speed.
It is possible to use mutliple PDF instances at the same time. Each instance is fully isolated from
each other and thread-safe.
Thread-safety
If multiple instances are used in different threads, make sure that code executed in callback
functions, e.g. in the error callback function, is thread safe too. If unsafe code must be executed,
acquire a mutex and lock the thread before calling non-thread safe code.
Thread-safety is guaranteed for every PDF instance but it is not allowed to call functions of one
instance in different threads.
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/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;
 

Previous topic: MoveTo, MultiplyMatrix

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