Skip to main content
Participating Frequently
February 23, 2021
Question

PDF of invoices to sort, batch, print, if possible?

  • February 23, 2021
  • 3 replies
  • 3082 views

Hello,

 

I have a large PDF (8000+ pages). In its original form the front is an invoice and the reverse is standard wording. I'm wondering if the following is possible. If so, what order is the best way to sort, batch and print:

 

  1. Sort invoices by Account and Invoice # into two (2) batches
    1. Single invoices (Account with one (1) invoice)
    2. Multiple invoices (Account with multiple invoices)
  2. Add reverse page standard wording (if necessary, to remove before batching)
  3. Print batches
    1. Single invoices
    2. Multiple invoices with a separator page per account #

 

I was able to remove the reverse standard wording using JavaScript I found online, now I'm looking for the rest of the solution to batch and add the standard wording before printing the invoices.

 

 

This topic has been closed for replies.

3 replies

Participating Frequently
March 3, 2021

Evermaps's Auto Split Pro solved it! 

Karl Heinz  Kremer
Community Expert
Community Expert
March 3, 2021

I am glad you found a solution. I've not used the Evermap tools in a long time, and I forgot that that was still available. 

Participating Frequently
March 3, 2021

I tried A-PDF's split program, although it has a decent GUI, it take 12+ hours to split a 38mb PDF containing 8300 double sided pages - but it didn't include a merge function and Adobe can't natively handle 500+ files at a time; Evermap split the same PDF in 5min and merged them in 45s.

 

And at least by using Evermap others can use it for more than just one type of invoice I have it currently setup for; the cost is low and benefit is high is using Evermap.

 

Karl Heinz  Kremer
Community Expert
Community Expert
February 23, 2021

This can very likely be done  - as long as you can get all the words on the PDF page. You would need to use the doc.getPageNthWord() method to enumerate all words on the page to find the account and invoice number information. See here for more information about this method: https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/index.html#t=Acro12_MasterBook%2FJS_API_AcroJS%2FDoc_methods.htm%23TOC_getPageNthWordbc-54&rhtocid=_6_1_8_23_1_53

 

I've successfully done what you describe, but it's a lot of work. One thing that helps to cut down on processing time is to crop the page to just the section where you expect the account and invoice information to be, and then search for the information, followed by reversing the crop function. 

Participating Frequently
February 23, 2021

This gives me hope! Thank you! I'll continue to search, read and sort out a solution. 

Karl Heinz  Kremer
Community Expert
Community Expert
February 23, 2021

You mentioned above that you are not an experience JavaScript programmer. You may want to take some time to learn. Here is a cheap and hopefully easy way to get started: http://khkonsulting.com/2017/01/learning-to-program-javascript-for-adobe-acrobat/

Here is something else that might help you to get started: http://khkonsulting.com/2014/04/extract-pdf-pages-based-content/

 

try67
Community Expert
Community Expert
February 23, 2021

This might be possible, but will require a custom-made script. The script will have to be able to identify where each record begins, and where it ends (since they are not all of the same length). It will also have to find a way of extracting the account and invoice numbers, based on their location on the page, or on a textual pattern (for example, if they are always preceded by same text, like "Account Number: XXXXX").

In addition, sorting the pages once this information has been found is not a trivial task. I usually prefer creating a new file and add the pages to it in the sorted order, instead of sorting the original file. It's a bit less efficient, but much easier to code.

All of the above requires a high level of Acrobat JS knowledge and experience.

Participating Frequently
February 23, 2021

Thanks for the reply - I figured it would require a custom script; unfortuantely, I'm not an expert in JS, but I am willing to learn and able to solve problems (with help of course). Luckily the invoices have a standard format, the account and invoice # are always in the same location on the page.

 

Do you have a reccomended guide on JS for Adobe Pro?

try67
Community Expert
Community Expert
February 23, 2021

Here are some good resources:

General JS tutorial (note that only the core syntax applies to Acrobat):

http://www.w3schools.com/js/default.asp

Homepage for Acrobat JavaScript development, including a link to the full API:

http://www.adobe.com/devnet/acrobat.html

Free tutorials about Acrobat in general, including many JS related ones: https://acrobatusers.com/tutorials/

A paid-for website with tutorials about Acrobat JavaScript (not related to me): http://www.pdfscripting.com/

My humble web-site with many tools for Acrobat (mostly paid-for, some free): https://try67.com

 

If you're interested in hiring a professional to create this script for you feel free to contact me privately via [try6767 at gmail.com] to discuss it further.