Re: Merge PDFs with forms - PDF version7

iText mailing list <[email protected]> Mon, 20 Oct 2014 08:45:22 +0200
Newsgroups gmane.comp.java.lib.itext.general
Message-ID <[email protected]>
You are mixing all kinds of things you shouldn't mix.

For instance: you are posting a question to the mailing-list for iText 
and iTextSharp, yet in your question you mention the copycat product 
"PDFSharp", written by people who wanted to copy the success of iText.

You are talking about PDF version 7 forms, but there is no such thing as 
PDF version 7 forms.

You either have forms based on AcroForm technology. In this case the 
fields are described using PDF objects such as field dictionaries, 
widget annotation dictionaries, etc... These forms can easily be merged, 
regardless of the fact if they are PDF 1.7, 1.6,...

You also have forms based on the XML Forms Architecture (XFA) in which 
case the PDF acts as a contained for an XML stream. Usually such a form 
starts from an XML schema.

Based on the "your PDF viewer may not be able to display this type of 
document" message, it seems that you are dealing with XFA forms.

If you want to merge pure XFA forms, you have the following options:
1. If the forms have the same schema, you extract the XML data from both 
forms, merge the XML data and fill an empty form with the merged data. 
This assumes that you know the XML schema and that you know how to merge 
the XML data.
2. If the forms don't have the same schema, it will be extremely 
difficult (if not impossible) to merge the forms and keep the forms 
interactive: you'd need to create a new schema for the data and 
basically create a new form from scratch.
3. You could flatten the forms first (using our closed source XFA 
worker) and then merge the flattened PDFs. The end result will no longer 
be a form.

You may be in luck if the forms are "hybrid". That is: if they contain a 
description of the form using both technologies next to each other, but 
please start by rephrasing your question based on the info provided in 
my answer, more specifically: tell us which type of form you are talking 
about: AcroForm, XFA or hybrid?

On 10/19/2014 21:03 PM, Gonçalo M. wrote:
>
> Hi everybody,
>
> I'm trying to use itextsharp to merge two PDF files (version 7), both 
> having form fields. When I run the code I get this error message: 
> "Cannot handle iref streams. The current implementation of PDFsharp 
> cannot handle this PDF feature introduced with Acrobat 6." I tried 
> different approaches but in my last I got the PDFs but instead of the 
> original file contents, I got a file with the following info:
>
> Please wait... If this message is not eventually replaced by the 
> proper contents of the document, your PDF viewer may not be able to
>
> display this type of document. You can upgrade to the latest version 
> of Adobe Reader for Windows®, Mac, or Linux® by visiting 
> http://www.adobe.com/go/reader_download. For more assistance with 
> Adobe Reader visit http://www.adobe.com/go/acrreader. Windows is 
> either a registered trademark or a trademark of Microsoft Corporation 
> in the United States and/or other countries. Mac is a trademark of 
> Apple Inc., registered in the United States and other countries. Linux 
> is the registered trademark of Linus Torvalds in the U.S. and other 
> countries.
>
> Can anyone help me and post some working code method to concatenate 
> two Pdfs of this kind. Thank you in advance.
>
> Kind Regards,
>
> GN
>
>
>
> ------------------------------------------------------------------------------
> Comprehensive Server Monitoring with Site24x7.
> Monitor 10 servers for $9/Month.
> Get alerted through email, SMS, voice calls or mobile push notifications.
> Take corrective actions from your mobile device.
> http://p.sf.net/sfu/Zoho
>
>
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> iText(R) is a registered trademark of 1T3XT BVBA.
> Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/
> Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php

------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho

_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php