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

Create successful ePaper yourself

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

String optlist13 =<br />

"OPI-1.3 { ALDImageFilename bigfile.tif " +<br />

"ALDImageDimensions {400 561} " +<br />

"ALDImageCropRect {10 10 390 550} " +<br />

"ALDImagePosition {10 10 10 540 390 540 390 10} }";<br />

image = p.load_image("tiff", filename, optlist13);<br />

Note Some OPI servers, such as the one included in Helios EtherShare, do not properly implement OPI<br />

processing for PDF Image XObjects, which <strong>PDFlib</strong> generates by default. In such cases generation<br />

of Form XObjects can be forced by supplying the template option to load_image( ).<br />

XMP metadata in images. Image files may contain XMP metadata. By default <strong>PDFlib</strong><br />

ignores image metadata for images in the TIFF, JPEG, and JPEG 2000 image formats to<br />

reduce the output file size. However, the XMP metadata can be attached to the generated<br />

image in the output PDF document with the following option of load_image( ):<br />

metadata={keepxmp=true}<br />

7.1.2 Supported Image File Formats<br />

<strong>PDFlib</strong> deals with the image file formats described below. By default, <strong>PDFlib</strong> passes the<br />

compressed image data unchanged to the PDF output if possible since PDF internally<br />

supports most compression schemes used in common image file formats. This technique<br />

(called pass-through mode in the descriptions below) results in very fast image import,<br />

since decompressing the image data and subsequent recompression are not necessary.<br />

However, <strong>PDFlib</strong> cannot check the integrity of the compressed image data in this<br />

mode. Incomplete or corrupt image data may result in error or warning messages when<br />

using the PDF document in Acrobat (e.g., Read less image data than expected). Passthrough<br />

mode can be controlled with the passthrough option of load_image( ).<br />

If an image file can’t be imported successfully load_image( ) will return an error code.<br />

If you need to know more details about the image failure, call get_errmsg( ) to retrieve a<br />

detailed error message.<br />

PNG images. <strong>PDFlib</strong> supports all flavors of PNG images (ISO 15948). PNG images are<br />

handled in pass-through mode in most cases. If a PNG image contains transparency information,<br />

the transparency is retained in the generated PDF (see Section 7.1.4, »Image<br />

Masks and Transparency«, page 184).<br />

JPEG images. JPEG images (ISO 10918-1) are never decompressed, but some flavors may<br />

require transcoding for proper display in Acrobat. <strong>PDFlib</strong> automatically applies transcoding<br />

to certain types of JPEG images, but transcoding can also be controlled via the<br />

passthrough option of load_image( ). Transcoding does not change the pixel count or color<br />

of an image, and does not introduce any visible compression/decompression artifacts.<br />

<strong>PDFlib</strong> supports the following JPEG image flavors:<br />

> Grayscale, RGB (usually encoded as YCbCr), and CMYK color<br />

> Baseline JPEG compression which accounts for the vast majority of JPEG images.<br />

> Progressive JPEG compression.<br />

JPEG images can be packaged in several different file formats. <strong>PDFlib</strong> supports all common<br />

JPEG file formats, and will read resolution information from the following flavors:<br />

> JFIF, which is generated by a wide variety of imaging applications.<br />

7.1 Importing Raster Images 181

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

Saved successfully!

Ooh no, something went wrong!