10.07.2015 Views

Download - Multivac!

Download - Multivac!

Download - Multivac!

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

not possible. Instead, all required fonts must be configured in PDFlib. If multiple importeddocuments contain embedded font data for the same font, PDI will not removeany duplicate font data. On the other hand, if fonts are missing from some importedPDF, they will also be missing from the generated PDF output file. As an optimizationyou should keep the imported document open as long as possible in order to avoid thesame fonts to be embedded multiple times in the output document.PDI does not change the color of imported PDF documents in any way. For example,if a PDF contains ICC color profiles these will be retained in the output document.PDFlib uses the template feature for placing imported PDF pages on the output page.Since some third-party PDF software does not correctly support the templates, restrictionsin certain environments other than Acrobat may apply (see Section 3.2.4, »Templates«,page 58).PDFlib-generated output which contains imported pages from other PDF documentscan be processed with PDFlib+PDI again. However, due to restrictions in PostScriptprinting the nesting level should not exceed 10.Code fragments for importing PDF pages. Dealing with pages from existing PDF documentsis possible with a very simple code structure. The following code snippet opens apage from an existing document, and copies the page contents to a new page in the outputPDF document (which must have been opened before):int doc, page, pageno = 1;String filename = "input.pdf";if (p.begin_document(outfilename, "") == -1) {...}...doc = p.open_pdi_document(infilename, "");if (doc == -1)throw new Exception("Error: " + p.get_errmsg());page = p.open_pdi_page(doc, pageno, "");if (page == -1)throw new Exception("Error: " + p.get_errmsg());/* dummy page size, will be modified by the adjustpage option */p.begin_page_ext(20, 20, "");p.fit_pdi_page(page, 0, 0, "adjustpage");p.close_pdi_page(page);...add more content to the page using PDFlib functions...p.end_page_ext("");p.close_pdi_document(doc);The last argument to PDF_fit_pdi_page( ) is an option list which supports a variety of optionsfor positioning, scaling, and rotating the imported page. Details regarding theseoptions are discussed in Section 7.3, »Placing Images and Imported PDF Pages«, page 158.Dimensions of imported PDF pages. Imported PDF pages are regarded similarly to importedraster images, and can be placed on the output page using PDF_fit_pdi_page( ). Bydefault, PDI will import the page exactly as it is displayed in Acrobat, in particular:> cropping will be retained (in technical terms: if a CropBox is present, PDI favors theCropBox over the MediaBox; see Section 3.2.2, »Page Size«, page 56);> rotation which has been applied to the page will be retained.6.2 Importing PDF Pages with PDI (PDF Import Library) 131

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!