Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
PDFKit.Combine
Creates a new PDF file with all the given PDF files/references.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
PDFKit | 2.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes, on macOS | ✅ Yes |
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. 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. 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 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.
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"; Merge PDFs::InputPDF)]
If [MBS("IsError") = 0]
Set Variable [$list; Value:$list & $r & ¶]
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"; $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"; $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"; $NewPDF; $OutputPpath) ]
# and open it!
Set Variable [ $r ; Value: MBS("Files.LaunchFile"; $OutputPpath) ]
See also
- Files.Launch
- Files.LaunchFile
- IsError
- Path.FileMakerPathToNativePath
- PDFKit.CombineRef
- PDFKit.Open
- PDFKit.OpenContainer
- PDFKit.Release
- PDFKit.SetCurrentFilter
- PDFKit.SetIgnoreCombineErrors
Release notes
- Version 12.2
- Changed PDFKit.Combine to ignore empty value in parameters.
- Version 11.5
- Fixed a crash in PDFKit.Combine function.
- Version 11.4
- Fixed a crash with PDFKit.Combine function.
- Version 11.3
- Fixed an issue with PDFKit.Combine called with multiple containers.
Example Databases
Blog Entries
- MBS FileMaker Plugin, version 12.2pr1
- MBS FileMaker Plugin, version 11.5pr1
- MBS FileMaker Plugin, version 11.3pr1
- FileMaker and PDF Containers
- MBS FileMaker Plugin, version 5.5pr1
- Compressing PDFs with PDFKit in FileMaker
FileMaker Magazin
This function is free to use.
Created 18th August 2014, last changed 1st May 2022