10.07.2015 Views

Download - Multivac!

Download - Multivac!

Download - Multivac!

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.

tion) if the user coordinate system hasn’t been scaled (since there are 72 default units toan inch).Cookbook A full code sample can be found in the Cookbook topic images/image_dimensions. It shows howto get the dimensions of an image and how to place it with various sizes.Color space of imported images. Except for adding or removing ICC profiles and applyinga spot color according to the options provided in PDF_load_image( ), PDFlib willgenerally try to preserve the native color space of an imported image. However, this isnot possible for certain rare combinations, such as YCbCr in TIFF which will be convertedto RGB.PDFlib does not perform any conversion between RGB and CMYK. If such a conversionis required it must be applied to the image data before loading the image in PDFlib.Inline images. As opposed to reusable images, which are written to the PDF output asimage XObjects, inline images are written directly into the respective content stream(page, pattern, template, or glyph description) . This results in some space savings, butshould only be used for small amounts of image data (up to 4 KB) per a recommendationin the PDF reference. The primary use of inline images is for bitmap glyph descriptionsin Type 3 fonts.Inline images can be generated with the PDF_load_image( ) interface by supplying theinline option. Inline images cannot be reused, i.e., the corresponding handle must not besupplied to any call which accepts image handles. For this reason if the inline option hasbeen provided PDF_load_image( ) internally performs the equivalent of the followingcode:p.fit_image(image, 0, 0, "");p.close_image(image);Inline images are only supported for imagetype=ccitt, jpeg, and raw. For other imagetypes the inline option will silently be ignored.6.1.2 Supported Image File FormatsPDFlib deals with the image file formats described below. By default, PDFlib passes thecompressed image data unchanged to the PDF output if possible since PDF internallysupports most compression schemes used in common image file formats. This technique(called pass-through mode in the descriptions below) results in very fast image import,since decompressing the image data and subsequent recompression are not necessary.However, PDFlib cannot check the integrity of the compressed image data in thismode. Incomplete or corrupt image data may result in error or warning messages whenusing the PDF document in Acrobat (e.g., Read less image data than expected). Passthroughmode can be controlled with the passthrough option of PDF_load_image( ).If an image file can’t be imported successfully PDF_load_image( ) will return an errorcode. If you need to know more details about the image failure, call PDF_get_errmsg( ) toretrieve a detailed error message.PNG images. PDFlib supports all flavors of PNG images (ISO 15948). PNG images arehandled in pass-through mode in most cases. PNG images which make use of interlacingor contain an alpha channel (which will be lost anyway, see below) will have to beuncompressed, which takes significantly longer than pass-through mode. If a PNG im-122 Chapter 6: Importing Images and PDF Pages

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

Saved successfully!

Ooh no, something went wrong!