17.05.2014 Views

PDFlib 8 Windows COM/.NET Tutorial

PDFlib 8 Windows COM/.NET Tutorial

PDFlib 8 Windows COM/.NET Tutorial

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Using this technique you can make sure that the pages in the generated PDF will have<br />

the exact same page size, cropping are etc. as the pages of the imported document. This<br />

is especially important for prepress applications.<br />

7.3.6 Querying Information about placed Images and PDF Pages<br />

Information about placed images. The info_image( ) function can be used to query image<br />

information. The supported keywords for this function cover general image information<br />

(e.g. width and height in pixels) as well as geometry information related to placing<br />

the image on the output page (e.g. width and height in absolute values after<br />

performing the fitting calculations).<br />

The following code fragment retrieves both the pixel size and the absolute size after<br />

placing an image with certain fitting options:<br />

String optlist = "boxsize={300 400} fitmethod=meet orientate=west";<br />

p.fit_image(image, 0.0, 0.0, optlist);<br />

imagewidth = (int) p.info_image(image, "imagewidth", optlist);<br />

imageheight = (int) p.info_image(image, "imageheight", optlist);<br />

System.err.println("image size in pixels: " + imagewidth + " x " + imageheight);<br />

width = p.info_image(image, "width", optlist);<br />

height = p.info_image(image, "height", optlist);<br />

System.err.println("image size in points: " + width + " x " + height);<br />

Information about placed PDF pages. The info_pdi_page( ) function can be used to query<br />

information about placed PDF pages. The supported keywords for this function cover<br />

information about the original page (e.g. its width and height) as well as geometry information<br />

related to placing the imported PDF on the output page (e.g. width and<br />

height after performing the fitting calculations).<br />

The following code fragment retrieves both the original size of the imported page<br />

and the size after placing the page with certain fitting options:<br />

String optlist = "boxsize={400 500} fitmethod=meet";<br />

p.fit_pdi_page(page, 0, 0, optlist);<br />

pagewidth = p.info_pdi_page(page, "pagewidth", optlist);<br />

pageheight = p.info_pdi_page(page, "pageheight", optlist);<br />

System.err.println("original page size: " + pagewidth + " x " + pageheight);<br />

width = p.info_pdi_page(page, "width", optlist);<br />

height = p.info_pdi_page(page, "height", optlist);<br />

System.err.println("size of placed page: " + width + " x " + height);<br />

198 Chapter 7: Importing Images and PDF Pages (Edition for <strong>COM</strong>, .<strong>NET</strong>, and REALbasic)

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

Saved successfully!

Ooh no, something went wrong!