Free Support Forum -

Concatenate and Populate same PDF Form multiple times


I am using Aspose.Pdf for .NET - Aspose.Pdf_7.2.0. I would like to take the pdf form located at and create a new pdf document that is the same form repeated multiple times, just with different data.

So if I had a result set with 5 entries that contain all of the data to populate the form, I would like to populate the first document, then populate and append documents 2-5. I would like each document to still be editable, so I don’t want to flatten the pdf before concatenation.

I am currently unable to concatenate the documents. I get the error message: System.Xml.XPath.XPathException: ‘topmostSubform_Aspose_N#1’ has an invalid token.
at MS.Internal.Xml.XPath.XPathParser.ParseXPathExpresion(String xpathExpresion)
at System.Xml.XPath.XPathExpression.Compile(String xpath, IXmlNamespaceResolver nsResolver)
at System.Xml.XPath.XPathNavigator.Select(String xpath)
at System.Xml.XmlNode.SelectNodes(String xpath)

I have attempted to modify the form field names in hope that that would then allow the document to concatenate, but I have not had any luck with that either.

Is there a way with Aspose.pdf to take the pdf from the url from above, duplicate the pdf, populate the form elements on each page with different data, and save the pdf? I basically just want to fill that form our with code a bunch to times then put them all together into one editable pdf file.

I have attached a small VS project that shows the error.

Hi Joshua,

Thanks for you inquiry. We are working over your query and will update you soon.

Best Regards,

Hi Joshua,

I’ve investigated the scenario and came to know your source document is XFA form. Concatenation of XFA form is not supported by Aspose.Pdf even Adobe Acrobat doesn’t support this feature. As a workaround, you can fill the XFA form first then convert the pages of XFA form into image format and later generate the PDF document based over these images. But this approach allows to concatenate documents as static images and you will not be able to edit/add information in PDF resultant document.

Thanks for your patience and understanding.

Please feel free to contact us for any further assistance.

Best Regards,