DynaPDF Manual - Page 657

Previous Page 656   Index   Next Page 658

Function Reference
Page 657 of 839
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:
imageWidth
= 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.
Dithering
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:
cfOrderedDithering
-> Simple ordered dithering
cfDitherFloydSteinberg -> Floyd-Steinberg dithering
cfConvGrayToOtsu
-> Optimal filter for OCR engines
 

Previous topic: RenderPageToImage (Rendering Engine)

Next topic: RenderPDFFile (obsolete), RenderPDFFileEx