DynaPDF Manual - Page 592

Previous Page 591   Index   Next Page 593

Function Reference
Page 592 of 839
file but not after the file was already imported. In addition, the memory usage must be restricted.
Optimize() can flush pages away after optimization but it is also important to make sure that not too
much memory will be consumed before the function is called.
Therefore, the right flags must be used when importing a PDF file. Here are the default import flags
that should be used when optimizing PDF files:
pdfSetImportFlags(pdf, ifImportAll | ifImportAsPage);
pdfSetImportFlags2(pdf, if2UseProxy | if2DuplicateCheck);
The above flags avoid the conversion of pages to templates, the memory usage will be reduced, and
a duplicate check is applied.
Many other flags are available but the above flags can be used by default whenever a PDF file
should be optimized.
Error handling
This function adds warnings to the error log of DynaPDF. The error log can be accessed with
GetErrLogMessageCount() / GetErrLogMessage().
Return values:
If the function succeeds the return value is 1. If the function fails the return value is 0. No PDF file is
in memory if the function fails. Therefore, it is not required to call FreePDF() on failure.
 

Previous topic: Image size check, Masked images (color key masking), Hairline correction, Possible issues, Special flags, Recommendations

Next topic: PageLink