DynaPDF Manual - Page 556
Previous Page 555 Index Next Page 557

Function Reference
Page 556 of 883
scaling of PDF pages (scaling is only possible with templates). So, if you want to scale the pages to
another page format then the conversion of pages to templates is required.
However, in most cases scaling is not required. The conversion of pages to templates should be
avoided in this case by setting the flag ifImportAsPage:
pdfSetImportFlags(pdf, ifImportAll | ifImportAsPage);
The advantage is that non-converted pages are a little bit smaller and a PDF file can be imported
and written to disk arbitrary often without increasing the file size or the nesting depth of templates.
Especially the nesting depth of templates can be an important aspect if a PDF file must edited
multiple times. Note that each time a PDF file is imported, while pages are converted to templates,
the nesting depth of templates becomes incremented. So, if you would import and save a PDF file in
a loop, while each time pages are converted to templates, the resulting PDF file becomes larger and
larger, and the nesting depth of templates becomes higher and higher. A nesting depth of more than
8 can already cause printing problems. Viewer applications support usually much higher nesting
depths but the memory usage becomes then very large and the rendering speed is decreased.
Incremental updates
Incremental updates are useful when small changes should be saved quickly, e.g. adding
annotations or comments, or if a PDF file should be digitally signed more than one time.
At time of publication the decision whether a PDF file should be incrementally updated or not must
already be made when opening the file. To achieve this, the flag if2IncrementalUpd must be set before
opening the file with OpenImportFile() or OpenImportBuffer() (see SetImportFlags2() for further
information). After that the file must be imported with ImportPDFFile().
Notice:
It is known that this workflow is not optimal. It would be more comfortable if this decision
could be made when closing the file. However, this is not yet possible.
Only the first import file can be incrementally updated. The PDF instance should also be in its initial
state. That means it is not allowed to create pages, bookmarks, or something like that, before loading
the file that should be incrementally updated.
The initial state is more or less something that we have right after CreateNewPDF() was called. With
exception of the document info entries, anything that changes the PDF file in memory must be done
AFTER the file to be updated was loaded and not before! Since document metadata is always
written to the output file, it is allowed to set document info entries before loading the file.
See also section Incremental Updates for further information.
Return values:
If the function succeeds the return value is the last page number that was touched. For example, if
the document in memory contains already 20 pages, and if we import a PDF file with 23 pages, and
Previous topic: ImportPDFFile
Next topic: InitBarcode2