Convert XFA to Acroform and Merge PDFs using Aspose.PDF for .NET - Please wait... If this message is not eventually replaced

To whom it may concern,

I am try to merge file A.pdf with the file B.pdf or C.pdf, however when I merge the files, the content of the file A.pdf become the following message:

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/products/acrobat/readstep2.html.
For more assistance with Adobe Reader visit
http://www.adobe.com/support/products/
acrreader.html.
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.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/products/acrobat/readstep2.html.
For more assistance with Adobe Reader visit
http://www.adobe.com/support/products/
acrreader.html.
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.

when I merge B.pdf and C.pdf, I get both files content

Here is my code:

AsposePDFLink.License license = new AsposePDFLink.License();

license.SetLicense("Aspose.Pdf.lic");

AsposePDFLink.Facades.PdfFileEditor pdfEditor = new AsposePDFLink.Facades.PdfFileEditor();

bool merged = pdfEditor.Concatenate(InputFiles, OutputFile);

if (!merged)

{

var _corrupted = pdfEditor.CorruptedItems;

string _LogError = pdfEditor.ConversionLog;

StringBuilder sbMessage = new StringBuilder();

sbMessage.Append("Unable to Merge PDFs:");

foreach (var item in InputFiles) { sbMessage.AppendFormat("{0}\\n", item); } sbMessage.AppendFormat("Output files:{0}", OutputFile);

throw new ApplicationException(sbMessage.ToString());

}

I have attached the individuals files and the merge outcome.

thank you

Hi Cody,


Thanks for contacting support.

The reason you are getting a message when concatenating B.pdf with other PDF documents is because B.pdf is an Dynamic XFA form whereas the other documents are standard AcroForms. So in order to resolve this problem, first you need to convert the XFA form to standard form and then concatenate thedocuments.

Please try using the following code snippet to convert XFA form to standard AcroForm.

[C#]

// load dynamic XFA form<o:p></o:p>

Document document2 = new Document("c:/pdftest/B.pdf");

// set the form fields type as standard AcroForm

document2.Form.Type = FormType.Standard;

document2.Save(“c:/pdftest/B_AcroForm_Document.pdf”);


After conversion to AcroForm, please try merging/concatenating the PDF documents. You may consider using the Document class to merge the PDF files.

[C#]

// load first document<o:p></o:p>

Document document = new Document("c:/pdftest/A.pdf");

// load second documnt

Document document2 = new Document("c:/pdftest/B_AcroForm_Document.pdf");

// add pages of second document to pages collection of first document

document.Pages.Add(document2.Pages);

document.Save(“c:/pdftest/A_B_Merged_Document_Standard.pdf”);



Please visit the following links for further information on

In the event of any further query, please feel free to contact. We are sorry for this inconvenience.

Hello Nayyer ,

Thank you for your responds. I change my concatenation process with the code example that you provide. I was able to convert the documents from dynamic to standard. However I have another problem with the concatenation process. I have attched pdf document A and B, which has filable fields, but when they are combined together all the filable fields are gone (Concatenating _A_B_.pdf). Here is my code:

string OutputFile = "Concatenating _A_B_.pdf";
bool conversionNeeded = false;
string FileA = "A.pdf";
Document mergeDocument = new AsposePDFLink.Document(FileA);
// set the form fields type as standard AcroForm
if (mergeDocument.Form.Type == AsposePDFLink.InteractiveFeatures.Forms.FormType.Dynamic)
{
mergeDocument.Form.Type = AsposePDFLink.InteractiveFeatures.Forms.FormType.Standard;
conversionNeeded = true;
// save the resultant PDF
FileA = "A_Standard.pdf";
mergeDocument.Save(FileA);
convertIndex++;
}
if (conversionNeeded)
{
mergeDocument = null;
mergeDocument = new AsposePDFLink.Document(FileA);
}

conversionNeeded = false;
string FileB = "B.pdf";
Document nextDocument = new AsposePDFLink.Document(FileB);
// set the form fields type as standard AcroForm
if (nextDocument.Form.Type == AsposePDFLink.InteractiveFeatures.Forms.FormType.Dynamic)
{
nextDocument.Form.Type = AsposePDFLink.InteractiveFeatures.Forms.FormType.Standard;
conversionNeeded = true;
// save the resultant PDF
FileB = "B_Standard.pdf";
nextDocument.Save(FileB);
convertIndex++;
}
if (conversionNeeded)
{
nextDocument = null;
nextDocument = new AsposePDFLink.Document(FileB);
}
mergeDocument.Pages.Add(nextDocument.Pages);
mergeDocument.Save(OutputFile);

thank you

Alvaro

Hi Alvaro,


Thanks for your inquiry. We have already observed the issue and logged issue as PDFNEWNET-35307 in our issue tracking system for resolution. I’ve also linked your request to the issue and we will update you as soon it is resolved.

Sorry for the inconvenience faced.

Best Regards,

Hi Cody,


Thanks for your patience.

We have further investigated the issue PDFNEWNET-35307 reported earlier and as per our understanding, the modifications cannot be made to document which has extended Rights feature enabled. In case any modification is made (document merge), the feature is lost.