Xojo Conferences

DynaPDF Manual - Page 490

Previous Page 489   Index   Next Page 491

Function Reference
Page 490 of 770
SI32 pdfInsertImageEx(
const PPDF* IPDF,
// Instance pointer
double PosX,
// X-Coordinate of destination rectangle
double PosY,
// Y-Coordinate of destination rectangle
double ScaleWidth,
// Scaled width of destination rectangle
double ScaleHeight, // Scaled height of destination rectangle
const char* AFile,
// File path
UI32 Index)
// Image index
The function inserts an image from a file. The parameter Index specifies the image index of a multi-
page image. The first image index is denoted by 1. If the image file is not a multi-page image, the
paramter Index will be ignored. To determine the number of images stored in an image file call the
function GetImageCount().
The image will be compressed with the compression filter that was set with SetCompressionFilter().
The default filter is Flate, which is a lossless compression filter. JPEG images should be inserted in
pass-though mode if possible, see the description of the JPEG filter below.
Supported image formats
The function does not depend on a correct file extension. It parses the image header to determine the
image format. The following image formats are supported:
BMP -> Device independent bitmaps with and without a valid file header. Embedded PNG
and JPEG images are supported. Which filter should be used for bitmaps depends on type pf
the image. Bitmaps are usually uncompressed or run-length encoded. Since Flate is a loss-less
compression filter, this filter can be used as a default if the filter cannot be changed in the
GIF -> The best alternate compression filter for GIF images is Flate encoding. GIF images are
treated as single page image. It is not possible to access a specific frame of a GIF animation.
JPG -> JPEG images should be inserted in pass-though mode if possible. See the description
of the compression filter below.
JP2, JPC, JPX -> These formats are JPEG 2000 compressed images.
PBM, PGM, PNM, PPM -> ASCII and Binary encoded images.
PNG -> Flate compressed images. Since Flate is the native compression filter of PNG images
this filter should be set when inserting the image.
PSD -> Only the preview image will be processed.

Previous topic: InsertImage (obsolete)

Next topic: How to get the image format?, Color spaces, How to change the color depth?, Duplicate check, Compression Filters, Flate Encode, CCITT Fax G3/4, JBIG2