ImportXML with newline in data

Trying to populate a PDF template via ImportXML. Mostly working, but I have a couple fields that are large, and in which the users often copy/paste formatted data from other applications. Tabs and multiple spaces seem to be handled OK in the translation to PDF, but newlines are getting lost. Is this expected behavior? How can I get the import to honor the newlines?


Template and sample data file attached.

If it helps, here’s my code (C#):

Aspose.Pdf.Facades.Form pdfForm = new Aspose.Pdf.Facades.Form();
MemoryStream ms = new MemoryStream((new System.Net.WebClient()).DownloadData(@“http://localhost/MYPATH/CompReport.pdf”));
pdfForm.BindPdf(ms);
MemoryStream msInput = new MemoryStream((new System.Net.WebClient()).DownloadData(@“http://localhost/MYPATH/CompReport.xml”));
pdfForm.ImportXml(msInput);
MemoryStream outStream = new MemoryStream();
pdfForm.Save(outStream);
return outStream;

Hi Andrew,


Thanks for contacting support.

I have tested the scenario using Aspose.Pdf for .NET 11.1.0 in Visual Studio2010 project and as per my observations, the newlines are properly being honored. For your reference, I have attached the output generated over my end. Can you please share some further details and image file which can help us in identifying the areas where line break is failing. We are sorry for your inconvenience.

Your output is the same as mine. The layout of the PDF is correct, but the content of the Narrative and Modified Narrative fields is not. As you can see in the XML file, there are newlines in the text. As your attachment shows, those newlines are not reflected in the resulting PDF.

Hi Andrew,


Thanks for sharing the details.

I have tested the scenario and have managed to reproduce the same issue. For the sake of correction, I have logged this problem as PDFNEWNET-40151 in our issue tracking system. We will further look into the details of this problem and will keep you posted on the status of correction. Please be patient and spare us little time. We are sorry for this inconvenience.