Welcome Guest Search | Active Topics | Sign In | Register

PDF Merge Problem Options
Bob Pinella
Posted: Tuesday, July 10, 2018 3:52:04 PM
Rank: Member
Groups: Member

Joined: 10/14/2014
Posts: 17
Hello,
I have encountered a strange problem when merging multiple PDF documents together. I have 2 PDF template documents that have editable fields. When I fill in the data and save the document, everything looks good. However when I use this to create a composite document:

Code: C#
pdf = PdfDocument.Merge(pdf, templatePdf)


Only the first page retains the filled in data. All other pages have empty fields, even though I can see that each individual document does have data in those fields. I have noticed that this problem only seems to show up in Acrobat Reader. If you view the Merged document in the browser(IE or Chrome), all of the editable fields have data in them. Do you have an idea as to what is causing this or how we can fix it? We need to be able to view these PDFs using Acrobat Reader. I will send a test project that demonstrates this problem. Thank you for your time.

Bob Pinella
eo_support
Posted: Wednesday, July 11, 2018 5:32:31 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
Hi,

This is normal. The root of the problem your merging process is creating duplicate fields. A PDF file has a single global form and this form contains all the fields that are identified by their name. Your code creates multiple fields with the same name in this form. The exact behavior for this is not clearly defined in the PDF specification. So some reader can handle this better than others.

In order to avoid such issue, you need to avoid duplicate field names. If the form fields are not meant to be modified by the end user, then the cleanest way to do this is to do it without form field at all. One way to do it is to use a HTML file instead of PDF file as template, then you can reformat the HTML file with each data source item, combine the result HTML into a big single HTML string and then use our HTML to PDF converter to produce the final PDF file.

If you must use form fields, then you can try to rename each field to a unique field name and see if it works for you.

Thanks!
Bob Pinella
Posted: Thursday, July 12, 2018 9:47:02 AM
Rank: Member
Groups: Member

Joined: 10/14/2014
Posts: 17
Hello,
Thank you for the reply - ok that explains the weird behavior I have been experiencing. We have an automated process that runs per customer and then merges all of the documents into a single PDF. I was able to rename the form fields per customer so that they are unique and the problem has disappeared. Thank you very much for your assistance with this!

Bob
eo_support
Posted: Thursday, July 12, 2018 4:29:05 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
Great. Glad to hear that! Please feel free to let us know if there is anything else.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.