Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

DynaPDF Manual - Page 584

Previous Page 583   Index   Next Page 585

Function Reference
Page 584 of 750
the page format. Larger resolutions require special techniques like banding to restrict the
memory usage. However, no such feature is available in DynaPDF.
If Width > 0 and if Height == 0 the image height is calculated according to the given width to
achieve an image with exact proportions.
If Width == 0 and if Height > 0 then image width is calculated according to the given height to
achieve an image with exact proportions.
If Width > 0 and if Height > 0 the image is scaled to the width and height.
The pixel format and the output image format must be compatible. Because TIFF is the only image
format that supports different compression filters, the parameter Filter will be ignored for all other
output formats if the pixel format is not set to pxfGray. For gray images, the filter is also used to
determine whether the Floyd-Steinberg dithering algorithm should be applied (see 1 Bit Rendering).
If Resolution is greater zero the image size will be calculated as follows:
imageWidth
= pageWidth
* Resolution / 72.0
imageHeight = pageHeight * Resolution / 72.0
The page width and height is calculated according to the bounding boxes and orientation. Rendering
PDF pages to a specific resolution is not recommended since PDF pages can be very large (up to
14.400 x 14.400 units) and this makes it impossible to render arbitrary pages due to memory
limitations.
A page should be scaled to a specific width or height to achieve predictable results. The helper
function CalcPagePixelSize() can be used to calculate the missing width or height so that the image
buffer can be allocated.
1 Bit Rendering
If the pixel format pxf1Bit is used, the page will be rendered with a simple 1 bit dither matrix
algorithm. This kind of rendering is fast but not very accurate.
A very high quality can be achieved with a Floyd-Steinberg Dithering algorithm with the cost of
some more processing time. To enable Floyd-Steinberg Dithering the pixel format must be set to
pxfGray and the compression filter must be set to cfCCITT3, CCITT4, cfLZWBW, or FlateBW. CCITT
Fax and LZW compression are supported with TIFF images. Flate compression can be used with
TIFF and PNG images. Anti-Aliasing should be disabled when creating 1 bit images since this avoids
anti-aliasing artefacts on the resulting image.
Note that Flate compression is no standard filter for TIFF images. If the image should be usable with
Adobe's Photoshop then use either CCITT Fax or LZW compression (cfLZWBW).
If the output format is Bitmap (BMP) the compression filter is only used to determine whether Floyd-
Steinberg Dithering should be used. The compression filter can be set to any of the above values.
Remarks:
This function is available in an Ansi and Unicode compatible version. Unicode file paths are
converted to UTF-8 on non-Windows operating systems.
 

Previous topic: RenderPageToImage (Rendering Engine)

Next topic: RenderPDFFile (Rendering Engine)