We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Convert XFA to AcroForm and concatenate PDF files using Aspose.PDF for .NET

We are use Aspose.Pdf.Facades to merget those files.

pdfEditor.Concatenate(inputFiles, outputFile);

Could you tell why it fail?


Hi Wei,

Thanks for your inquiry.

Please note you are concatenating dynamic PDF forms so getting the exception. You should convert dynamic XFA Form to Acro Form before concatenation. Please check documentation link to convert dynamic XFA Form to Acro Form and following code for concatenation. It will help you to accomplish the task.

string OutputFile = myDir + “Concatenating_XFA_DOM.pdf”;
MemoryStream ms1 = new MemoryStream();
MemoryStream ms2 = new MemoryStream();
string FileA = myDir + "-EREPLDIS-NY-D.pdf";
Document mergeDocument = new Document(FileA);
// set the form fields type as standard AcroForm
if (mergeDocument.Form.Type == FormType.Dynamic)
{
 mergeDocument.Form.Type = FormType.Static;
}
mergeDocument.Save(ms1);
string FileB = myDir + "-EREPLDIS-NY-DEF.pdf";
Document nextDocument = new Document(FileB);
// set the form fields type as standard AcroForm
if (nextDocument.Form.Type == FormType.Dynamic)
{
 nextDocument.Form.Type = FormType.Standard;
}
nextDocument.Save(ms2);
mergeDocument = new Document(ms1);
nextDocument = new Document(ms2);
mergeDocument.Pages.Add(nextDocument.Pages);
mergeDocument.Save(OutputFile);
ms1.Close();
ms2.Close();

Please feel free to contact us for any further assistance.

Best Regards,