|
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
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
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!
|
|
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
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
Great. Glad to hear that! Please feel free to let us know if there is anything else.
|
|