DynaPDF Manual - Page 576
Previous Page 575 Index Next Page 577
Function Reference
Page 576 of 839
To avoid this issue, it is possible to hold more than one parser instance 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()). The flag reduces also the memory usage and should
normally be set by default.
The function returns the file or parser handle in this case, a value greater or equal zero. This handle
can be used to close or re-open a specific parser instance with CloseImportFileEx() or
ReOpenImportFile().
CloseImportFile() closes the last open import file as usual and deletes the corresponding parser
instance.
A parser instance requires about 280 KB memory depending on the number of objects in it. The
memory usage grows a little bit when pages will be imported. Therefore, it is recommended to close
instances when no longer needed to reduce the memory usage.
PDF files with only one page should be closed immediatly after the contents was imported.
OpenImportFile() checks whether an existing instance can be used before it creates a new one.
Therefore, it is safe to open the same PDF file arbitrary often. More efficient to re-open existing
parser instances is to call ReOpenImportFile() with the file handle that OpenImportFile() returned.
DynaPDF makes sure that no more than 6 file handles are opened simultaneously during import.
Maximal 12 files are kept opened simultaneously if SetUseGlobalImpFiles() was set to true. This
ensures that mutliple PDF files can be efficiently imported and written to disk without using too
many system resources. The overhead to re-open additional files is minimal.
Editing encrypted PDF files
If your application should allow the modification of encrypted PDF files, you may check the access
permissions to grant user rights, if the file was opened with the open password instead of the owner
password (see also GetUserRights()).
Due to the license agreement of Adobe, all manufacturers of applications which make the treatment
of encrypted PDF files possible, must respect the access permissions of a PDF file, if the file was
opened with the open password.
Only if the file was opened with the owner password, all rights should be granted. See PDF Reference
1.7 for further information. This document is available at http://www.adobe.com.
If the property UseExactPwd is set to false (see SetUseExactPwd()), the function checks whether the
open or owner password in the file is an empty string. If one password is not set, then the file is
decrypted no matter whether the supplied password was wrong.
However, the property UseExactPwd should be true, if the application is a commercial product
(default).
Previous topic: OpenImportFile, Recommended settings to split PDF files, How to keep multiple PDF files open?
Next topic: Damaged PDF files
Web links on this page: