Page 1 of 1

Add appendix pdf after every page of letter pdf

Posted: Tue Dec 03, 2019 12:20 pm
by JimmyHartington
I have a flow, where I need to insert an appendix pdf after every page of a letter pdf.

The number of pages in the appendix pdf is not the same for each run.
The number of recipients in the letter pdf is also variable.

My solution now is to split the letter pdf. Using the command line tool PDFTK I insert the appendix pdf. The job is then assembled and merge to a new pdf-file.

This works but can be very slow, if there are many recipients.

So I was curious if any one had a good tool for this?

Re: Add appendix pdf after every page of letter pdf

Posted: Tue Dec 03, 2019 1:44 pm
by JimmyHartington
So I found a solution based on a Acrobat javascript.

Now I use the Acrobat configurator.

This is the script.

Code: Select all

/* Add blank page for script to work */
$doc.newPage(0, 100, 100);

/* add page after each nth page */
var n = 1;
for (var i=$doc.numPages-1; i>0; i--) {
    if ((i+1) % n == 0) {
        $doc.insertPages(i, "/path/to/appendix/pdf-file/" + $arg1);
    }
}

/* Delete first page */
$doc.deletePages({nStart: 0, nEnd: 0});
Arguement 1 is the name of the appendix-file.

It is faster than my previous solution, but still not as fast as I would like.
What I would like was some kind of commandline utility.

Re: Add appendix pdf after every page of letter pdf

Posted: Tue Dec 03, 2019 4:09 pm
by 3f8h.net
We can do this using callas pdfToolbox CLI.

Re: Add appendix pdf after every page of letter pdf

Posted: Tue Dec 03, 2019 7:53 pm
by JimmyHartington
How is it done with pdfToolbox CLI?

Re: Add appendix pdf after every page of letter pdf

Posted: Wed Dec 04, 2019 10:44 am
by Arthur
Quite Imposing - insert pages ('from file' at interval).
Done.

Re: Add appendix pdf after every page of letter pdf

Posted: Wed Dec 04, 2019 11:28 am
by JimmyHartington
@Arthur
Thanks. But I do not have Quite Imposing for my server.
It needs to be done automatic.

Re: Add appendix pdf after every page of letter pdf

Posted: Wed Dec 04, 2019 1:05 pm
by Arthur
Well - it can be automated with Quite Hot Folders. But I presume you do not have that one either....
We've been using Quite for years and it was a natural choice to keep things that way when we implemented Switch. But I understand not everyone has got it, in favour of other tools.
Yet - this seemed the most straightforward solution to me....

Re: Add appendix pdf after every page of letter pdf

Posted: Wed Dec 04, 2019 1:41 pm
by 3f8h.net
Do you have pdfToolbox CLI installed and licensed?

Re: Add appendix pdf after every page of letter pdf

Posted: Thu Dec 05, 2019 5:34 pm
by JimmyHartington
@3f8h.net: No. I do not have a license for pdfToolbox CLI.