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

Free Support Forum - aspose.com

Converting docx to pdf - issue with line ending characters

Hi guys,
I'm trying to use Aspose.Words to fill a docx template, and then to save it to pdf. I've encountered problems in convertion of line end characters.
First, I have a template docx file (Test.docx), in which I replace some fields with multiline texts, using Aspose.Words with the following code (VB.Net):

Dim r As New Run(node.Document, "first line")

node.ParentNode.InsertAfter(r, node)

r = New Run(node.Document, ControlChar.LineBreakChar & "second line")

node.ParentNode.AppendChild(r)

r = New Run(node.Document, ControlChar.LineBreakChar & "third line")

node.ParentNode.AppendChild(r)

node.Remove()

where "node" is the original node, which I'm going to replace.
After these replacements I save the file as docx to a new file name (result.docx). I checked its xml structure, and it looks similar to the files made by MS Word 2010.
Finally I convert the above result.docx file to pdf, using Aspose.Words.Save method. Its result is the attached result.pdf file.
The problem is, that the pdf file (result.pdf) has some "black squares" at the beginning of the new lines created by the above code.
I used Visual Studio 2008, Aspose for Framework 2 (version 10.5.0.0) for creating the file, on a Windows XP machine and Office 2003 installed.
Would you please be so kind to check this problem and help me to resolve it.
Please find attached the referenced files.
Many thanks and all the best,
Eva Balint.

Hi

<o:p> </o:p>

Thank you for reporting this problem to us, I managed to reproduce it on my side. Your request has been linked to the appropriate issue. We will let you know once it is resolved.

As a temporary workaround, you can remove LineFeed characters from your document. For example, see the following code:

<o:p> </o:p>

Document doc = new Document(@“Test001\in.docx”);<o:p></o:p>

doc.Range.Replace(ControlChar.LineFeed, “”, false, false);<o:p></o:p>

doc.Save(@“Test001\out.pdf”);

<o:p> </o:p>

Best regards,

Hi Alexey,

Thank you very much for your response. I can use your workaround, the resulting pdf file now is correct.

Best regards,
Eva Balint.

The issues you have found earlier (filed as WORDSNET-5167) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan