DynaPDF.RenderPDFFileEx
-----------------------

Renders whole PDF file in current PDF to an image.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [DynaPDF](component_DynaPDF.md) | [8.0](newinversion80.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "DynaPDF.RenderPDFFileEx"; PDF { ; DestPath; Resolution; Width; Height; Flags; PixelFormat; Filter; Format } ) 

**MBS**( **"DynaPDF.RenderPDFFileEx";** /\* Renders whole PDF file in current PDF to an image. \*/  
**$PDF**; /\* The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). \*/   
**$DestPath**; /\* Optional; A file path for storing images.   
Can be folder for multiple images files or file for one file. If a folder, it must exist.e.g. "/Users/cs/Desktop/test.jpg" \*/   
**$Resolution**; /\* Optional; The resolution you'd like to have for the image. If you pass zero, we use default resolution (72).e.g. 150 \*/   
**$Width**; /\* Optional; Desired width.e.g. 600 \*/   
**$Height**; /\* Optional; Desired height.e.g. 800 \*/   
**$Flags**; /\* Optional; 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"e.g. 0 \*/   
**$PixelFormat**; /\* Optional; The pixel format. Can be 1bit, gray, RGB, BGR, RGBA, BGRA, ARGB, ABGR, CMYK, CMYKA and GrayA. Default is RGB.e.g. "RGB" \*/   
**$Filter**; /\* Optional; The compression filter to use. Can be Flate, JPEG, CCITT3, CCITT4, LZW or JP2K. Default is JPEG.e.g. "JPEG" \*/   
**$Format**) /\* Optional; The image format to use. Can be TIFF, JPEG, PNG, BMP or JPC. Default is JPEG.e.g. "JPEG" \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| PDF | The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). | $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 |

### Result

Returns OK or error.

### Description

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](component_DynaPDF.md) 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 &gt; 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 &gt; 0 and Width &lt; 0 and or Height &lt; 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 &gt; 0 or Height &gt; 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](DynaPDFInitColorManagement.md) or [DynaPDF.InitColorManagementEx](DynaPDFInitColorManagementEx.md) to initialize color management, so conversions to other colorspaces like CMYK work better.  
See also [RenderPDFFileEx](https://www.monkeybreadsoftware.com/DynaPDF-Manual/RenderPDFFileEx.shtml) function in DynaPDF manual.

### See also

- [DynaPDF.InitColorManagement](DynaPDFInitColorManagement.md)
- [DynaPDF.InitColorManagementEx](DynaPDFInitColorManagementEx.md)
- [DynaPDF.Initialize](DynaPDFInitialize.md)
- [DynaPDF.New](DynaPDFNew.md)
- [DynaPDF.RenderPDFFile](DynaPDFRenderPDFFile.md)

### Release notes

- **Version 15.2**
    - Added PremulAlpha as a possible raster flag for [DynaPDF.RenderPage](https://www.mbsplugins.eu/DynaPDFRenderPage.shtml), [DynaPDF.RenderPDFFile](https://www.mbsplugins.eu/DynaPDFRenderPDFFile.shtml) and [DynaPDF.RenderPDFFileEx](https://www.mbsplugins.eu/DynaPDFRenderPDFFileEx.shtml) functions.
- **Version 8.0**
    - Added [DynaPDF.RenderPDFFileEx](http://www.mbsplugins.eu/DynaPDFRenderPDFFileEx.shtml), [DynaPDF.FileAttachAnnotEx](http://www.mbsplugins.eu/DynaPDFFileAttachAnnotEx.shtml) and [DynaPDF.ExtractText](http://www.mbsplugins.eu/DynaPDFExtractText.shtml).

### Blog Entries

- [MBS FileMaker Plugin, version 15.2pr7](https://www.mbsplugins.de/archive/2025-04-30/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 8.0 - More than 5000 Functions In One Plugin](https://www.mbsplugins.de/archive/2018-01-23/MBS_FileMaker_Plugin_80_-_More/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plug-in 8.0 - Über 5000 Funktionen in einem Plugin](https://www.mbsplugins.de/archive/2018-01-23/MBS_FileMaker_Plug-in_80_-_Üb/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 7.6pr5](https://www.mbsplugins.de/archive/2017-12-22/MBS_FileMaker_Plugin_version_7/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

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

  
[DynaPDF.RenderPDFFile](DynaPDFRenderPDFFile.md) - [DynaPDF.RenderPage](DynaPDFRenderPage.md)

[HTML Version](DynaPDFRenderPDFFileEx.shtml)