Extending FileMaker PDF functionality with DynaPDF

Generating PDFs in FileMaker

FileMaker Pro has had the ability to generate PDF documents since version 8, providing basic functionality that has remained largely unchanged since its introduction. Using FileMaker Pro’s plugin architecture, we can extend this functionality to provide the following enhancements:

  • Search PDF document text
  • Append multiple PDF documents in non-sequential order
  • Add a watermark to a PDF document
  • Password protect a PDF document
  • Delete pages from a PDF document
  • Add clickable “Page Links” to move to different pages throughout a PDF document
  • Compress a PDF file to prepare them for transmission over the internet

An intermediate to advanced FileMaker Pro developer can leverage these features to create even more dynamic PDF documents inside FileMaker Pro.

Setup and Installation

The MBS FileMaker Plugin by MonkeyBread Software has one of the most feature-packed plugins in the FileMaker community with over 5,000 functions to date and developer Christian Schmitz continues to regularly add new features. As a side note, one of my favorite features is a more colorful script syntax coloring but there are many more that can be useful in a variety of situations.

Using the MBS plugin, we can extend its functionality even further using the DynaPDF library. DynaPDF is a popular library for working with PDFs that the MBS plugin allows us to access using functions. For DynaPDF alone, you can use 484 custom functions inside FileMaker Pro.

To setup this up, first download the MBS plugin. Included in that download is the DynaPDF library in both macOS and Windows formats. Read the installation documentation to know where to install the DynaPDF library on your computer. It is also worth noting DynaPDF and MBS FileMaker Plugin can also run as a server-side plugin, allowing you to leverage the power of server processing and not require an individual license for DynaPDF on every end user computer.

Plugin Functions & Scripting

All DynaPDF functions use a dot syntax starting with “DynaPDF.” DynaPDF requires some sequential steps to manipulate a PDF document. Using the “Set Variable” step we can increment the DynaPDF library and create a memory space inside FileMaker Pro. Here is an overview of this process using FileMaker script steps:

#Initialize new PDF instance
 Set Variable [$pdf; Value:MBS ( "DynaPDF.New" )]
 #Convert path to DynaPDF native path
 Set Variable [$targetPath; Value:MBS( "Path.FileMakerPathToNativePath";  $fruitPath )]
 #Open Existing PDF into memory
 Set Variable [$x; Value:MBS ( "DynaPDF.OpenPDFFromFile" ; $pdf ; $targetPath )]

After we call these initialize functions, we can perform any number of DynaPDF functions to this PDF we have brought into memory. Check out a complete listing of DynaPDF functions.

To complete the PDF manipulation process and save our changes to the PDF document we perform the following steps:

#Denote where to save changes to PDF file, could be same path or different path
 Set Variable [$x; Value:MBS ( "DynaPDF.OpenOutputFile" ; $pdf ; $targetPath )]
 #Save will commit those changes to that path
 Set Variable [$x; Value:MBS ( "DynaPDF.Save" ; $pdf )]
 #Release clears the memory space, allowing a new instance of "DynaPDF.new" to be created.
 Set Variable [$x; Value:MBS ( "DynaPDF.Release" ; $pdf )]

It is important to note that you can redirect the output of your changes to a different file path than the one you started with in the initialization functions earlier.

Download Our Demo File

You can use our complimentary demo file to demonstrate a few capabilities of DynaPDF. This file contains a simple table containing pictures and images of different types of fruit. The goal is to create a listing of each fruit with clickable links to different pages throughout the PDF.

First, DynaPDF allows us to create two PDFs and then combine them in the reverse order. We can parse the text of each page of the PDF to determine the page number of each fruit in the document. After combining the PDFs, we can add “Page Links” into specific locations on each page, allowing us to hyperlink within our combined PDF document. We use this in two ways —  first, by having a table of contents page that allows us to jump to a specific fruit on a page and second, by having a button on each page that allows us to return to the table of contents page. This minimizes the need to scroll through each page of the PDF, creating a more fluid user experience.

Enhancing FileMaker Pro with PDF Document Manipulation

With some script steps and external plugin functions, we see how powerful we can make FileMaker Pro by manipulating PDF documents. We can link around a PDF document dynamically, combine multiple PDF documents in different order and parse text from specific pages in a PDF, and much more.

PDF functionality has remained the same for almost 15 years in FileMaker Pro. By using FileMaker Pro’s plugin architecture we can extend that functionality to build even more powerful custom applications. What kind of apps could you build with this powerful set of PDF tools?

Next Steps for Your FileMaker Solution

If you have any questions about this functionality or seek a development partner in using it to take your FileMaker solution to the next step, please contact our team. We’re happy to provide additional insights and determine if we’re a good fit for your next project.


References

2 thoughts on “Extending FileMaker PDF functionality with DynaPDF”

  1. Hi
    I saw that with the filemaker runtime (all the versions) is not possible to make a pdf document.
    Is it possible to do it with your plug-in ?
    Thanks in advance

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top