DynaPDF Manual - Page 615

Previous Page 614   Index   Next Page 616

Function Reference
Page 615 of 787
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 ordered dither
matrix algorithm. This kind of rendering is fast but not very accurate. Since this pixel format has no
alpha channel (which is sometimes required), the output can be wrong if the file uses transparency.
To avoid issues with transparency it is recommended to render into a gray pixel format (pxfGray or
pxfGrayA) and to apply a dithering algorithm on the result. This can be achieved by combining the
compression filter with one of the available dithering algorithms:
-> Simple ordered dithering
cfDitherFloydSteinberg -> Floyd-Steinberg dithering
-> Optimal filter for OCR engines
In order to compress the image with CCITT Fax 4, for example, and to apply a simple ordered
dithering algorithm, combine the compression filter and dithering flag with a binary or operator,
e.g. TCompressionFilter(cfCCITT4 | cfOrderedDithering).
Anti-Aliasing should be disabled when creating 1 bit images to avoid anti-aliasing artifacts.
The Otsu filter is useful if an OCR scan should be applied on the resulting 1 bit image. Most OCR
engines produce best results with this filter.
If the output format is Bitmap (BMP) the compression filter is used only to determine whether a
dithering algorithm should be applied. The compression filter can be set to any of the above values.
This function is available in an Ansi and Unicode compatible version. Unicode file paths are
converted to UTF-8 on non-Windows operating systems.
Return values:
If the function succeeds the return value is 1. If the function fails the return value is 0.

Previous topic: RenderPageToImage (Rendering Engine)

Next topic: RenderPDFFile (obsolete), RenderPDFFileEx

Start Chat