Xojo Conferences

DynaPDF Manual - Page 131

Previous Page 130   Index   Next Page 132

Function Reference
Page 131 of 750
AddRasImage (Rendering Engine)
LBOOL pdfAddRasImage(
const PPDF* IPDF,
// PDF Instance pointer
IRAS* RasPtr,
// Instance pointer of the rasterizer
TCompressionFilter Filter) // Compression filter for TIFF output
The function adds an image from the rasterizer to the current open image file. The output image
must be opened with CreateImage() beforehand.
Note that the function performs no color conversion when the pixel format of the rasterizer is
incompatible to the output image format. For example, Windows Bitmaps support the pixel formats
BGR, or BGRA while all other image formats require pixels in the natural component order, RGB or
The caller must make sure that the image buffer of the rasterizer is defined in the correct component
order. If necessary swap the pixels before calling the function.
Windows Bitmaps require double word aligned scanlines while for all other image formats the
scanlines can be byte aligned. AddRasImage() adds required fill bytes automatically to achieve the
required line alignment. However, to increase conversion speed the image buffer should consider
the scaline alignment of the output image format.
The pixel format pxfCMYK and pxfCMYKA are supported by the TIFF and JPEG encoders only.
Because the JPEG encoder requires an inverted CMYK image as input, the function must invert the
image buffer for this image format. This must be considered if the image buffer should be passed to
another function after AddRasImage() was called.
TIFF is the one and only multi-page image format. All other image formats support exactly one
image. The image must be closed with CloseImage() when finish.
The parameter Filter is only considered for TIFF output because all other image formats support only
one specific compression filter. The compression filter must be compatible to the pixel format. For
example, CCITTFax compression is compatible to 1 bit images, it is not supported for gray or color
images. Note also that Flate is no standard TIFF compression filter. Many TIFF viewers cannot
display Flate compressed TIFF images. LZW is the alternate filter. LZW compression is faster than
flate and achieves almost the same compression ratios.
The function is able to create up to 2 GB large TIFF image files. Depending on the used compression
filter and compression ratio this is mostly enough to create TIFF images with up to 4000 pages in a
resolution of 150 DPI. However, the maximum number of pages depends on the compression ratio.
The JPEG Quality and compression level can be adjusted with SetJPEGQuality() and
SetCompressionLevel() before calling the function.
Return values:
When the function succeeds the return value is 1. When the function fails the return value is 0.

Previous topic: AddPageLabel

Next topic: AddValToChoiceField