DynaPDF Manual - Page 602

Previous Page 601   Index   Next Page 603

Function Reference
Page 602 of 770
TImageFormat Format)
// Output image format
The function renders all PDF pages which are currently in memory and stores the result in a
proprietary image format. The pages in memory could be imported from one or more external PDF
files, e.g. with ImportPDFFile(), created with DynaPDF functions, or a combination of both.
The parameter OutFile can be a path to an existing directory or the file name of the output image.
The latter type can be used with TIFF images because this format supports multi-page output. When
a file path is used with a single page image format only the first page will be rendered.
The function calls the Ansi C function stat() to determine whether the path is a directory or a file
name. A path to a directory must not end with a slash or backslash because stat() cannot identify a
directory in this case.
RenderPDFFile() and RenderPageToImage() use internally the same code and support therefore the
same features. Please read also the description of RenderPageToImage().
The function can render pages in a specific resolution, or scale them to a given width or height.
Depending on which parameters are set the image size is calculated as follows:
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 all pages 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.
On a 32 bit system it is possible to render PDF pages in RGB with up to around 1200 DPI, depending
on the page format and available memory. The resolution of gray images can be higher but the
encoder must be able to handle such large images. The PNG and bitmap encoders accept images in
almost arbitrary resolutions but all other encoders can fail if the resolution is larger than about 2000
The function calls the TInitProgressProc() callback function, if set, to initialize a progress bar. The
parameter ProgType is set to ptWritePage. The TProgressProc() callback function is executed before a
page is rendered. The function breaks processing if the return value of the progress callback function
is non-zero. See SetProgressProc() for further information.

Previous topic: RenderPDFFile (obsolete), RenderPDFFileEx

Next topic: ReplaceFont, ReOpenImportFile