DynaPDF Manual - Page 560

Previous Page 559   Index   Next Page 561

Function Reference
Page 560 of 821
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;
The function opens an external PDF file like OpenImportFile() but accepts a file buffer as input.
The function supports the additional flag ptDontCopyBuf to specify whether the import buffer
should be copied to an internal buffer or not.
If the flag ptDontCopyBuf is absent then DynaPDF creates a copy of the input buffer before it will be
accessed. The original buffer should be released immediately after the function returns in this case.
The internal copy of the file buffer will be released when CloseImportFile() is called, when loading
another PDF file, or when the PDF file in memory is closed.
If the flag ptDontCopyBuf is set, then the function works directly with the source buffer without
creating a copy of it. This reduces the memory usage and improves the processing speed due to the
unnecessary copy action. However, the caller must make sure that the buffer exist until
CloseImportFile() is called. When finish, call first CloseImportFile() and then release the input
buffer.
How to keep multiple memory based PDF files open?
It is also possible to hold more than one memory based PDF file simultaneously in memory. This is
the case if the flag if2UseProxy is set and if CloseImportFile() was not called before opening the next
 

Previous topic: MultiplyMatrix, NewPDF, Thread-safety

Next topic: OpenImportFile


Start Chat