DynaPDF.RenderPDFFile
---------------------

Renders whole PDF file in current PDF to an image.

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

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

**MBS**( **"DynaPDF.RenderPDFFile";** /\* 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 \*/   
**$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 |
| 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.  
You can choose the format and filter, but please make sure they match as not all combinations are valid.  
This can write multipage tiff files or a folder of image files.  
  
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.  
  
This function requires a native path. Use [Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md) to convert a FileMaker path to a native path if required. If you like to have the user choose the path, you can use [FileDialog](component_FileDialog.md) functions.  
For Server be aware that server has limited permissions and may not be able to access all files on a computer.  
See also [RenderPDFFile](https://www.monkeybreadsoftware.com/DynaPDF-Manual/RenderPDFFile.shtml) function in DynaPDF manual.

### Examples

Render PDF to desktop with several JPEG pages:

 $result = MBS ( "DynaPDF.RenderPDFFile"; $PDF ; "/Users/cs/Desktop"; 150; 0; "RGB"; "JPEG"; "JPEG" )  
Render TIFF with higher resolution:

 $result = MBS ( "DynaPDF.RenderPDFFile"; $PDF ; "c:\\test.tif"; 150; 0; "RGB"; "Flate"; "TIFF" )  
Open PDF and render page as image to container:

 # Start new PDF workspace   
Set Variable \[$pdf ; Value:MBS ("[DynaPDF.New](DynaPDFNew.md)")\]  
\# Load PDF from container   
Set Variable \[$r ; Value: MBS ("[DynaPDF.OpenPDFFromContainer](DynaPDFOpenPDFFromContainer.md)"; $pdf ; Test::data )\]  
\# Import all pages   
Set Variable \[$r ; Value: MBS ("[DynaPDF.ImportPDFFile](DynaPDFImportPDFFile.md)"; $pdf )\]  
\# Render one page as Picture   
Set Variable \[$r ; Value: MBS ( "DynaPDF.RenderPDFFile"; $PDF ; "c:\\test.tif"; 150; 0; "RGB"; "Flate"; "TIFF" ) )\]  
\# Put in Container   
Set Field \[Test::PageImage ; $r \]  
\# cleanup   
Set Variable \[$r ; Value:MBS ("[DynaPDF.Release](DynaPDFRelease.md)"; $pdf )\]  
### See also

- [DynaPDF.ImportPDFFile](DynaPDFImportPDFFile.md)
- [DynaPDF.InitColorManagement](DynaPDFInitColorManagement.md)
- [DynaPDF.InitColorManagementEx](DynaPDFInitColorManagementEx.md)
- [DynaPDF.Initialize](DynaPDFInitialize.md)
- [DynaPDF.OpenPDFFromContainer](DynaPDFOpenPDFFromContainer.md)
- [DynaPDF.Release](DynaPDFRelease.md)
- [DynaPDF.RenderPage](DynaPDFRenderPage.md)
- [DynaPDF.RenderPDFFileEx](DynaPDFRenderPDFFileEx.md)
- [DynaPDF.SetOCGState](DynaPDFSetOCGState.md)
- [Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.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, version 6.4pr3](https://www.mbsplugins.de/archive/2016-08-08/MBS_FileMaker_Plugin_version_6/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 5.3pr1](https://www.mbsplugins.de/archive/2015-08-26/MBS_FileMaker_Plugin_version_5/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin, version 4.5pr4](https://www.mbsplugins.de/archive/2014-12-19/MBS_Filemaker_Plugin_version_4/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 12nd December 2014 , last changed 17th July 2022

  
[DynaPDF.RenderJob](DynaPDFRenderJob.md) - [DynaPDF.RenderPDFFileEx](DynaPDFRenderPDFFileEx.md)

[HTML Version](DynaPDFRenderPDFFile.shtml)