PDFKit.Combine
--------------

Creates a new PDF file with all the given PDF files/references.

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

MBS( "PDFKit.Combine"; Name; PDFs... ) 

**MBS**( **"PDFKit.Combine";** /\* Creates a new PDF file with all the given PDF files/references. \*/  
**$Name**; /\* A text with the file name to include with the PDF.e.g. "test.pdf" \*/   
**$PDFs...**) /\* Several PDF references.   
A container value with the PDF content from a media field.   
Or a text with an URL.   
Or a PDF reference from [PDFKit.Open](PDFKitOpen.md).   
The function will fail if one of those is an image file. \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Name | A text with the file name to include with the PDF. | "test.pdf" |
| PDFs... | Several PDF references.    A container value with the PDF content from a media field.    Or a text with an URL.    Or a PDF reference from [PDFKit.Open](PDFKitOpen.md).    The function will fail if one of those is an image file. |  |

### Result

Returns the PDF container value.

### Description

Creates a new PDF file with all the given PDF files/references.   
You can pass container values, URLs or PDF references. You can pass one PDF reference to save to a new PDF.   
Please note the difference between PDFKit.Combine and [PDFKit.CombineRef](PDFKitCombineRef.md). Combine returns a new container value with the new PDF. CombineRef returns the new PDF reference for further processing.  
If on combining one of the PDF parameters is not a valid PDF, the function returns an error. You can use [PDFKit.SetIgnoreCombineErrors](PDFKitSetIgnoreCombineErrors.md) to disable that and ignore all PDFs which fail to open. For example if you write code which takes 4 container values and not all of them contain PDF files.  
  
Starting with version 6.0, the PDFs parameters can also be lists of paths or reference numbers.  
  
PDFKit does not guarantee preservation of the original PDF version. In practice it often rewrites the document as PDF 1.3/1.4 style content and may flatten or discard features it cannot represent in its writer.  
Typical things that can be lost when a PDF 1.5/1.6/1.7 document is rewritten include:  
- Transparency groups
- Optional content layers
- Object streams (introduced in PDF 1.5)
- XFA forms
- Certain annotations
- Embedded multimedia
- Advanced compression structures
- Some vendor-specific extensions

As a result, a PDF that displays correctly when opened can become incomplete after being re-saved through PDFKit.  
You may use [DynaPDF](component_DynaPDF.md) functions if you need anything from the above.  
  
This function takes variable number of parameters. Pass as much parameters as needed separated by the semicolon in FileMaker.  
Please repeat PDFs parameter as often as you need.  
### Examples

Combine two PDF files form two media fields into a new PDF

 MBS ("PDFKit.Combine"; "test.pdf"; mytable::test1 ; mytable::test2 )  
Merge PDFs:

 #Start with blank list   
Set Variable \[$list ; Value:""\]  
\#Load PDF from container   
Go to Record/Request/Page \[First\]  
Set Variable \[$destPage ; Value:1\]  
Loop  
 Set Variable \[$r ; Value:MBS ("[PDFKit.OpenContainer](PDFKitOpenContainer.md)"; Merge PDFs::InputPDF )\]  
 If \[MBS ("IsError") = 0\]  
Set Variable \[$list ; Value:$list &amp; $r &amp; ¶\]  
 End If  
 Go to Record/Request/Page \[Next; Exit after last\]  
End Loop  
Set Field \[Merge PDFs::FinalPDF ; MBS ("PDFKit.Combine"; "merge.pdf"; $list )\]  
Set Variable \[$r ; Value:MBS ("[PDFKit.Release](PDFKitRelease.md)"; $list )\]  
Merge PDFs with various paths:

 # native path to PDF   
Set Variable \[ $path1 ; Value: "/Users/cs/Desktop/test/file1.pdf" \]   
  
\# or file URL is fine   
Set Variable \[ $path2 ; Value: "file:///Users/cs/Desktop/test/file2.pdf" \]   
  
\# FileMaker style path needs conversion   
Set Variable \[ $path3 ; Value: "/Macintosh HD/Users/cs/Desktop/test/file3.pdf" \]   
Set Variable \[ $path3 ; Value: MBS ("[Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md)"; $path3 ) \]   
  
\# merge them to one PDF   
Set Variable \[ $NewPDF ; Value: MBS ( "PDFKit.Combine"; "output.pdf"; $path1 ; $path2 ; $path3 ) \]   
  
\# write it to disk   
Set Variable \[ $OutputPpath ; Value: "/Users/cs/Desktop/test/output.pdf" \]   
Set Variable \[ $r ; Value: MBS ("[Container.WriteFile](ContainerWriteFile.md)"; $NewPDF ; $OutputPpath ) \]   
  
\# and open it!   
Set Variable \[ $r ; Value: MBS ("[Files.LaunchFile](FilesLaunchFile.md)"; $OutputPpath ) \]  
### See also

- [Files.Launch](FilesLaunch.md)
- [Files.LaunchFile](FilesLaunchFile.md)
- [IsError](IsError.md)
- [Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md)
- [PDFKit.CombineRef](PDFKitCombineRef.md)
- [PDFKit.Open](PDFKitOpen.md)
- [PDFKit.OpenContainer](PDFKitOpenContainer.md)
- [PDFKit.Release](PDFKitRelease.md)
- [PDFKit.SetCurrentFilter](PDFKitSetCurrentFilter.md)
- [PDFKit.SetIgnoreCombineErrors](PDFKitSetIgnoreCombineErrors.md)

### Release notes

- **Version 16.3**
    - Improved PDFKit.Combine to copy metadata values from first document to the new document.
- **Version 12.2**
    - Changed [PDFKit.Combine](https://www.mbsplugins.eu/PDFKitCombine.shtml) to ignore empty value in parameters.
- **Version 11.5**
    - Fixed a crash in [PDFKit.Combine](https://www.mbsplugins.eu/PDFKitCombine.shtml) function.
- **Version 11.4**
    - Fixed a crash with [PDFKit.Combine](https://www.mbsplugins.eu/PDFKitCombine.shtml) function.
- **Version 11.3**
    - Fixed an issue with [PDFKit.Combine](https://www.mbsplugins.eu/PDFKitCombine.shtml) called with multiple containers.

### Example Databases

- [Mac and iOS/PDFKit/Combine PDFs](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20and%20iOS/PDFKit/Combine%20PDFs.shtml#1GroupButton294.000000079.0000000319.0000000270.0000000LayoutObjectAnchor_)
- [Mac and iOS/PDFKit/Compress PDF](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20and%20iOS/PDFKit/Compress%20PDF.shtml#1ScriptAnchor_)
- [Mac and iOS/PDFKit/Merge PDF](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20and%20iOS/PDFKit/Merge%20PDF.shtml#2ScriptAnchor_)
- [Mac and iOS/PDFKit/PDF Merge Shrink Tool](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20and%20iOS/PDFKit/PDF%20Merge%20Shrink%20Tool.shtml#16ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin, version 16.3pr2](https://www.mbsplugins.de/archive/2026-06-15/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 12.2pr1](https://www.mbsplugins.de/archive/2022-04-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 11.5pr1](https://www.mbsplugins.de/archive/2021-10-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 11.3pr1](https://www.mbsplugins.de/archive/2021-06-03/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [FileMaker and PDF Containers](https://www.mbsplugins.de/archive/2017-08-30/FileMaker_and_PDF_Containers/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 5.5pr1](https://www.mbsplugins.de/archive/2015-12-09/MBS_FileMaker_Plugin_version_5/monkeybreadsoftware_blog_filemaker)
- [Compressing PDFs with PDFKit in FileMaker](https://www.mbsplugins.de/archive/2014-08-20/Compressing_PDFs_with_PDFKit_i/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 1/2026, Seite 30](https://filemaker-magazin.de/neuigkeit/4312-Die-neue-Ausgabe-FMM_202601-steht-online)
- [Ausgabe 6/2022, Seite 14 bis 15](https://filemaker-magazin.de/neuigkeit/4206-Appetithappen-FMM_202206)
- [Ausgabe 5/2014, Seite 24](https://filemaker-magazin.de/neuigkeit/3759-Appetithappen-FMM_201405)

This function is free to use.

Created 18th August 2014 , last changed 12nd June 2026

  
[PDFKit.AppendPages](PDFKitAppendPages.md) - [PDFKit.CombineRef](PDFKitCombineRef.md)

[HTML Version](PDFKitCombine.shtml)