X-POST Blazing Fast PDF Merge update

Discussion created by datastride on Jan 12, 2013



I've been successfully using Matt Petrowsky's "blazing fast" method for merging PDFs successfully. (Thanks, Matt, for this terrific tool!!!)


But I ran into a problem that took a little head scratching to solve ... So I thought I'd share the solution in case anyone else encounters the same issue.


Matt's solution involves a ScriptMaster function called "catpdf" (relies on the ScriptMaster plug-in from 360Works). Lately some PDF files cause an error that stops the merge from completing.


Based on Matt's demo database (from FileMaker Magazine), I'm been using version 2.1.3 of the iText JAR that this ScriptMaster function requires. But the latest version of iText is identified as "5.3.5". I started wondering if perhaps the much older version if iText was having problems with some recent additions to the structure of PDF files. A lot of water has gone under the bridge since Matt first released his solution ... back in the FileMaker 9 days.


So I downloaded the newest "released" version of the iText library. You can get it here:


Note: You don't need the "extrajars" file.


And then you'll need to make a minor change to 4 lines of code inthe function itself, as some identifiers have changed in iText:


So these 4 lines:


import com.lowagie.text.Document;¶

import com.lowagie.text.pdf.PdfImportedPage;¶

import com.lowagie.text.pdf.PdfCopy;¶

import com.lowagie.text.pdf.PdfReader;¶


Become these 4 lines:


import com.itextpdf.text.Document;¶

import com.itextpdf.text.pdf.PdfImportedPage;¶

import com.itextpdf.text.pdf.PdfCopy;¶

import com.itextpdf.text.pdf.PdfReader;¶


So after recompiling with the new JAR file and the changes to the Groovy code, Matt's function now works like a champ with the newest iText library ... and the problems with the recently-generated PDFs have vanished. Everything is working again!


Peace, love & brown rice,

Morgan Jones


FileMaker + Web: Design, Develop & Deploy

Certifications: FileMaker 9, 10, 11 & 12

Member: FileMaker Business Alliance

One Part Harmony

Austin, Texas • USA