Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old


Renders whole PDF file in current PDF to an image.

Component Version macOS Windows Linux Server iOS SDK
DynaPDF 8.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "DynaPDF.RenderPDFFileEx"; PDF { ; DestPath; Resolution; Width; Height; Flags; PixelFormat; Filter; Format } )   More


Parameter Description Example Flags
PDF The PDF reference returned from DynaPDF.New. $pdf
DestPath A file path for storing images.
Can be folder for multiple images files or file for one file. If a folder, it must exist.
"/Users/cs/Desktop/test.jpg" Optional
Resolution The resolution you'd like to have for the image. If you pass zero, we use default resolution (72). 150 Optional
Width Desired width. 600 Optional
Height Desired height. 800 Optional
Flags Flags for rendering. Use 0 for the default flags. For other values, please look into dynapdf manual.
With version 6.4 of our plugin, you can also specify this by passing in text string, e.g. "Rotate90¶ClipToTrimBox"
0 Optional
PixelFormat The pixel format. Can be 1bit, gray, RGB, BGR, RGBA, BGRA, ARGB, ABGR, CMYK, CMYKA and GrayA. Default is RGB. "RGB" Optional
Filter The compression filter to use. Can be Flate, JPEG, CCITT3, CCITT4, LZW or JP2K. Default is JPEG. "JPEG" Optional
Format The image format to use. Can be TIFF, JPEG, PNG, BMP or JPC. Default is JPEG. "JPEG" Optional


Returns OK or error.


Renders whole PDF file in current PDF to an image.
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 DestPath 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 checks whether the path is a directory or a file name.
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 when the resolution is larger than about 2000 DPI.

Requires DynaPDF Pro license for the raster engine to create bitmaps from PDF pages.
Please use DynaPDF.InitColorManagement or DynaPDF.InitColorManagementEx to initialize color management, so conversions to other colorspaces like CMYK work better.

See also RenderPDFFileEx function in DynaPDF manual.

See also

Release notes

Blog Entries

This function checks for a license.

Created 21st December 2017, last changed 17th July 2022

DynaPDF.RenderPDFFile - DynaPDF.RenderPage