PDFKit.AddImageFilePage
-----------------------

Adds a new page to PDF document with given image file.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [PDFKit](component_PDFKit.md) | [7.2](newinversion72.md) | ✅ Yes | ❌ No | ❌ No | ✅ Yes, on macOS | ✅ Yes |

MBS( "PDFKit.AddImageFilePage"; PDF; FilePath { ; Width; Height } ) 

**MBS**( **"PDFKit.AddImageFilePage";** /\* Adds a new page to PDF document with given image file. \*/  
**$PDF**; /\* A PDF reference number from [PDFKit.Open](PDFKitOpen.md).e.g. $ref \*/   
**$FilePath**; /\* The file path to the image file to use.e.g. "/Users/cs/Desktop/test.png" \*/   
**$Width**; /\* Optional; The width for the new PDF page.e.g. 600 \*/   
**$Height**) /\* Optional; The height of the new PDF page.e.g. 800 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| PDF | A PDF reference number from [PDFKit.Open](PDFKitOpen.md). | $ref |  |
| FilePath | The file path to the image file to use. | "/Users/cs/Desktop/test.png" |  |
| Width | The width for the new PDF page. | 600 | Optional |
| Height | The height of the new PDF page. | 800 | Optional |

### Result

Returns OK or error.

### Description

Adds a new page to PDF document with given image file.  
If you need more control about details, you may want to check [DynaPDF](component_DynaPDF.md) functions.  
  
Your changes are only done in memory, so please remember to write modified pdf back to disk, e.g. by using [PDFKit.WriteToPath](PDFKitWriteToPath.md). Or use [PDFKit.GetPDFDocument](PDFKitGetPDFDocument.md) to get a PDF for storing in a container.  
  
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.  
### Examples

Create PDF from image file:

 Set Variable \[$ref ; Value:MBS ("[PDFKit.NewPDFDocument](PDFKitNewPDFDocument.md)")\]  
Set Variable \[$r ; Value:MBS ("PDFKit.AddImageFilePage"; $ref ; "/Users/cs/Desktop/test.jpg"; 640; 480)\]  
Set Variable \[$r ; Value:MBS ("[PDFKit.WriteToPath](PDFKitWriteToPath.md)"; $ref ; "/Users/cs/Desktop/test.pdf")\]  
Set Variable \[$result ; Value:MBS ("[PDFKit.Release](PDFKitRelease.md)"; $ref )\]  
### See also

- [Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md)
- [PDFKit.AddImagePage](PDFKitAddImagePage.md)
- [PDFKit.GetPDFDocument](PDFKitGetPDFDocument.md)
- [PDFKit.NewPDFDocument](PDFKitNewPDFDocument.md)
- [PDFKit.Open](PDFKitOpen.md)
- [PDFKit.Release](PDFKitRelease.md)
- [PDFKit.WriteToPath](PDFKitWriteToPath.md)

### Release notes

- **Version 7.2**
    - Added [PDFKit.AddImageFilePage](http://www.mbsplugins.eu/PDFKitAddImageFilePage.shtml) function.
    - Reduced memory usage for [PDFKit.AddImageFilePage](http://www.mbsplugins.eu/PDFKitAddImageFilePage.shtml) and [PDFKit.AddImagePage](http://www.mbsplugins.eu/PDFKitAddImagePage.shtml).

### Blog Entries

- [MBS FileMaker Plugin, version 7.2pr6](https://www.mbsplugins.de/archive/2017-05-11/MBS_FileMaker_Plugin_version_7/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin for iOS Update](https://www.mbsplugins.de/archive/2017-05-11/MBS_FileMaker_Plugin_for_iOS_U/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 9th May 2017 , last changed 9th May 2017

  
[PDFKit.AddEmptyPage](PDFKitAddEmptyPage.md) - [PDFKit.AddImagePage](PDFKitAddImagePage.md)

[HTML Version](PDFKitAddImageFilePage.shtml)