How to use a PDF letter head template page to write multi page of text

45 views
Skip to first unread message

Ajit Rautela

unread,
May 3, 2017, 8:26:01 PM5/3/17
to PDFTron PDFNet SDK
Hi I am trialing your product and have been asked to develop a proof of concept application. I have a requirement to create multi page PDF e-statement file. We are required to use a letter head PDF template page which some header and/or footer. We have e-statement data already formatted.

We need the use same template PDF and the e-statement data on it for all the pages. Could I please have some sample code for it?
Thanks

Ajit Rautela

unread,
May 4, 2017, 2:16:04 PM5/4/17
to PDFTron PDFNet SDK
ok, I have had some success creating a multi page PDF using one letter head PDF template. I am using doc.ImportPages(import_list) from samples to create all the PDF pages from the template (same page added multiple times) and use the document to write text on page by page.

The issue is that when I write multiple pages of text, they all show in all the pages. Meaning the text belonging to a page also show up in all other pages. I am guessing it is because I am using the same PDF template. Is their a way to 'reset' the subsequent pages to write different text on each page?

Ryan

unread,
May 24, 2017, 6:11:04 PM5/24/17
to PDFTron PDFNet SDK
It sounds like you created a Form XObject, which is a resource that can be shared amongst different pages. This is often ideal, as it reduces file size, but not ideal for your case.

Probably the best thing to do, since re-importing everytime would also duplicate things like font resources, is import the template once, and then use ElementEdit sample code to read from the template page, and write to the source page, changing whatever you want. This will create unique content streams, while sharing fonts, and any images.

To assist further we would need full code and input/output files.

Reply all
Reply to author
Forward
0 new messages