Spec me a PDF editor to automatically add templated pages to a PDF file based on number of pages

Soldato
Joined
14 Apr 2014
Posts
7,642
Location
Hampshire
Hi all

Currently rolling out some (online) software for a company which will be used to generate reports. The length of the reports is dynamic, and changes based upon the amount of content.


Once the reports are generated, they need to be printed on A3, and so for the structure to appear correct, the total number of pages needs to be divisible by 4, otherwise the "back page" doesn't appear at the back.


Hence, I need a solution which can automagically add pages to the downloaded PDF file based upon the length of the document. These pages will be a single PDF page template which I have created (it's just a blank page with text saying "page left intentionally blank".



For example, if the number of pages is 11, I need to add 1. If it's 13, I need to add 3. They need to be added just before the last page.



I've asked ChatGPT and considered automating this through Power Apps, but it seems quite complicated due to requiring add ons.



Does anybody here have any suggestions?


Thanks
 
> Once the reports are generated,

how are the reports generated ? do you have access to this generator ?

> they need to be printed on A3,

presumably you also need to consider the pagination layout which will change page order, which i dont think is being considered at generation stage ? Or is this being handled by the client at print time ?

I.e. for a 4 A4 page (A3 double sided) the pages will be 1,4 on front side, and 2,3 on reverse side. ?

> and so for the structure to appear correct, the total number of pages needs to be divisible by 4, otherwise the "back page" doesn't appear at the back.

See above i dont think it's just a case of adding extra pages ? --- how are the pdfs going to be printed, by who and what kit do they have access to ?


> Hence, I need a solution which can automagically add pages to the downloaded PDF file based upon the length of the document. These pages will be a single PDF page template which I have created (it's just a blank page with text saying "page left intentionally blank".

Any number of tools can easily do this? What code are you using to handle the pdf creation ?


> For example, if the number of pages is 11, I need to add 1. If it's 13, I need to add 3. They need to be added just before the last page.

FUNCTION next_multiple_of_4(number):
remainder = number MOD 4
IF remainder == 0:
next_number = number // Already divisible by 4
difference = 0
ELSE:
next_number = number + (4 - remainder)
difference = next_number - number
ENDIF

RETURN next_number, difference
END FUNCTION
 
how are the reports generated ? do you have access to this generator ?
Online with a report builder - this is the software I'm rolling out. I have access to it, but cannot easily add in pages dynamically.

presumably you also need to consider the pagination layout which will change page order, which i dont think is being considered at generation stage ? Or is this being handled by the client at print time ?

I.e. for a 4 A4 page (A3 double sided) the pages will be 1,4 on front side, and 2,3 on reverse side. ?

Pagination is handled by the printer and is configured correctly.

It's only the final page causing issues, hence why the additional pages need to be added just before it

how are the pdfs going to be printed, by who and what kit do they have access to ?

Printed in-house with decent Canons, which have the ability to print booklets, fold and saddle stitch.

Any number of tools can easily do this? What code are you using to handle the pdf creation ?

PDF is the output from the online tool, so not created by the company. No ability to (automatically) adapt to the number of pages within the tool.
 
I still dont get it. Where is the pdf output to? You have a a process here and you need to insert a new step ie add a page logic. But we don’t know the inputs or outputs

> PDF is the output from the online tool,

Output to where?

Cant the printers just handle this? I’d have thought there wiuld be an option


use pdftk ? pdftk A=bigpdf.pdf B=insert.pdf cat A1-11 B A12-end output output.pdf
 
Last edited:
Back
Top Bottom