Xojo Conferences

DynaPDF Manual - Page 597

Previous Page 596   Index   Next Page 598

Function Reference
Page 597 of 767
It is also possible to create the output image beforehand with CreateImage(). In this case the image
will be added to this image encoder and the parameter OutFile will be ignored. This can be useful
when creating multi-page TIFF images because the compression filter can be changed on every page
if necessary.
The output image size can be calculated in different ways:
Resolution > 0 and Width == 0 and Height == 0
Pages are rendered according to the given resolution. Note that PDF pages can be very large.
Therefore, it is maybe not possible to render the page in the wished resolution.
Resolution > 0 and Width < 0 and or Height < 0
Pages are rendered according to the given resolution. Negative values of Width and Height are
interpreted as maximum width or height if Resolution is greater zero. Since PDF pages can be
very large, it is recommended to set the maximum width and height to a value that is low
enough so that no out of memory exception occurs, e.g. 5000 x 5000 pixels.
Resolution == 0 and Width > 0 or Height > 0
Pages are scaled to the given Width or Height. If Width and Height are greater zero then pages
are scaled to that size independent of the original page format (not recommended). It is
usually best to set the width or height to zero so that the function can calculate the missing
value to preserve the aspect ratio.
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:
= pageWidth
* Resolution / 72.0
imageHeight = pageHeight * Resolution / 72.0
The page width and height is calculated according to the bounding boxes and orientation. When
rendering PDF pages to a specific resolution it is recommended to set also the maximum width and
height (as negative values) so that the image size can be restricted. This makes it possible to render
arbitrary PDF files in high resolutions without further considerations.
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.

Previous topic: 1 Bit Rendering

Next topic: ReOpenImportFile