DynaPDF Manual - Page 486

Previous Page 485   Index   Next Page 487

Function Reference
Page 486 of 777
Calling the function outside of an open page
If the function is called outside of an open page, no interactive objects are imported and the scaling
factors ScaleX and ScaleY are ignored. The page becomes converted to a template. The function works
then exactly like ImportPage(). The resulting template can be placed on one or more pages with
PlaceTemplate() or better PlaceTemplateEx(). The latter version is preferred because it considers the
coordinate origin of the template as well as a maybe existing crop box and it preserves the original
page orientation.
This function is available in an Ansi and Unicode compatible version.
Return values:
If the function succeeds and if the imported page was converted to a template, the return value is a
template handle, a value greater or equal zero.
If the imported page was not converted to a template and if the function succeeds, the return value is
zero. If the function fails the return value is a negative error code.
SI32 pdfImportPDFFile(
const PPDF* IPDF, // Instance pointer
UI32 DestPage,
// Add the new pages at this position
double ScaleX,
// Horizontal scaling factor (1.0 = no scaling)
double ScaleY)
// Vertical scaling factor (1.0 = no scaling)
The function imports an external PDF file including interactive objects such as annotations,
bookmarks, form fields, and so on. DynaPDF supports a large set of flags to enable import of
required objects only. Unwanted objects can be removed by the function if necessary. The import
flags are described in detail at SetImportFlags() and SetImportFlags2().
The parameter DestPage specifies the destination page on which the new pages will be inserted or
added if the pages already exist. It is possible to import multiple PDF files on the same or
overlapping destination page.
Example 1:
pdfOpenImportFile(pdf, "c:/test1.pdf");
pdfImportPDFFile(pdf, 1, 1.0, 1.0); // Start import at page one
// The previous PDF file will be closed automatically.
pdfOpenImportFile(pdf, "c:/test2.pdf");
// No we have overlapping pages. For instance, if both PDF files
// contain 3 pages, then we get 3 pages in which the pages of the second
// PDF file are placed on top of the already existing ones.
pdfImportPDFFile(pdf, 1, 1.0, 1.0);

Previous topic: ImportPageEx, Calling the function inside of an open page

Next topic: InitColorManagement