How to merge PDFs and consecutively number them in FileMaker
Sounds like it should be easy, almost built in, but it is not. Adding page numbers to PDFs is not a trivial task without additional software like Adobe Acrobat. Merging several FileMaker reports with additional PDFs and adding consecutive page numbers to the new document seems like it requires magic.
I recently had the opportunity to try my hand at this elusive problem and found that if you are familiar with Java and it is done correctly, it can make for a great solution to many workflow issues. A special thanks to Matt Petrowsky for his great example file that was very helpful at getting me started.
Here’s the situation: You have several reports that you create in FileMaker. You have additional PDF documents that you need to merge with them, and you also need them to be numbered so that you can email just one final PDF to your customers or team. To go through the process in Acrobat isn’t too bad the first one or two times, but when you need to do it often, it becomes a real chore.
Fortunately, there is a great Java library called iText. I have worked with iText on other projects and have found it to be very helpful. iText is an incredible open-source Java library that allows you to create and manipulate PDFs. It is worth checking out if you are a developer. It is a great library; you can merge PDFs, number them, get details about pages, and even create pages with content.
With iText and Java, it would seem our job is almost done, but how do you get FileMaker to run Java? Well that is where the last piece of the puzzle comes in, via a great tool by 360Works called ScriptMaster. ScriptMaster is a plug-in for FileMaker that allows you to write FileMaker custom functions able to run Java and provide access to Java libraries, using a Java language called Groovy.
If we team these three items up, we’re almost there. Let me recap, you take FileMaker, add a ScriptMaster plugin (to run Java), add the iText Java libraries, and then write FileMaker custom functions with Groovy that use Java library classes. Now you can make all the magic happen!
Aside from solving the above problem, what else can you do once you have these dependencies in place? One example would be to create a Document Library where you can store PDFs. Given the tools by iText, you can capture details about the PDFs when you add them to the library – like page size and page count – and then store that information in FileMaker. Later, you can group documents of your choice together, change their order, even merge and number them on command. Once you have created a final PDF document you can add the newly merged PDF back into the document library. This provides a great deal of flexibility for managing PDFs. Couple that with some of FileMaker’s other features and with the click of a button FileMaker can merge PDF reports with external PDF documents, put signatures on them, number them, and email them. Ta-da!
Your email address will not be published. Required fields are marked *
Save my name, email, and website in this browser for the next time I comment.