So I’m lazy, I admit it. And I had a personal itch for a program that could burst out PDF’s, search through them for a string, and then email it to a matching email address. Mainly this is to automated a process that I imagine probably happens in quite a few places. Lots of payroll systems can export vouchers to PDF but they often do so in to one large PDF (probably for printing or archiving or something) so then you end up with some poor poor payroll person splitting the PDF by hand using Adobe Acrobat, renaming each and every PDF to that person’s name, and then emailing out each and every PDF voucher. Doesn’t this just sound like a process that begs to be automated!! I actually have coded up a solution before in C++ using GhostScript, but it was specialized towards payroll vouchers only. This time around I decided to make a more generalized search PDF’s and then email program.
It turned out to be mainly an integration process. First I hit upon pdftk which can easily burst out PDF’s and it’s GPL as well. So the bursting was taken care of. Next I needed to convert the PDF to text so that I could search inside it. Here is where Xpdf comes in to play, it has a pdftotext.exe utility. (GPL as well!)
So I burst, then I export, and then I regex search, and then I email and wa la. PDF Search and Send is born.
So how do you use it?
First choose a folder that has PDF’s that you want to search and send by clicking thee ‘Select PDF Folder’ button.
Next hit the Edit Users button. The format is ‘what string you want to search on’ comma ‘what email address you want it sent to’
So lets say you had a voucher for Sam the format would be
Sam N nobody, firstname.lastname@example.org
Ok, then you fill in your mail server address, from, subject, and body and hit the magic ‘Send Matching PDF’s button’ if all goes well it should burst, and then send out, matching PDF’s to these people.
For downloads and updates this project is going to live here, https://michaelellerbeck.com/z-pdf-search-and-send/