Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

DynaPDF Manual - Page 510

Previous Page 509   Index   Next Page 511

Function Reference
Page 510 of 750
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.
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 whithout
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
PDF file (the flag can be set with SetImportFlags2()).
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!
 

Previous topic: NewPDF

Next topic: Recommended settings to split PDF files