Free Support Forum - aspose.com

Aspose.pdf.Save hits an infinite loop

I have a .doc file which I want to convert to pdf. The code I’m using (in VB.NET) can be shown in a simplified form bellow. After the document is converted to AsposePdf format and called to save the pdf, it hangs on pdf.save. I never get an exception and the current CPU core is at 100%, permanently. This problem came up only in some of the files I was trying to convert and I’ve managed to narrow it down to a comment(included in the doc file attached). I cannot send the original file, but this small doc reproduces the same issue. The version of Aspose.Pdf I’m using is 4.4.0.0 and it was tested in both Windows Server 2008 and XP with the same results, both in runtime as well as in debug mode.

Dim aDoc As Aspose.Words.Document = New Aspose.Words.Document(“FA.doc”)
aDoc.Save(“FA.xml”, SaveFormat.AsposePdf)
Dim aPdf As Aspose.Pdf.Pdf = New Aspose.Pdf.Pdf
aPdf.BindXML(“FA.xml”, Nothing)
aPdf.Save(“FA.pdf”)

I don’t care about keeping the comment in any form, but I must not modify the original documents.

Thanks in advance

Hello

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. As I can see you use old method of PDF conversion. Currently the latest version of Aspose.Words supports two ways of PDF conversion: direct conversion (without using Aspose.Pdf) and legacy conversion (Aspose.Words+Aspose.Pdf). See the following link for more information:

http://www.aspose.com/community/blogs/aspose.words-for-.net-java-and-reporting-services/archive/2008/12/12/converting-word-documents-to-pdf-with-aspose-words.aspx

You should note that we will exclude legacy (old) method of PDF conversion in one of our future versions. Also no new issues will be fixed in the legacy method. Please try using new SaveToPdf method. Here is the code:

Document doc = new Document("FA.doc");

doc.SaveToPdf("out.pdf");

Please feel free to ask me in case of any issues.

Best regards,

Hi,

Thanks for the reply. I have changed the reference to the latest version of Aspose.Words, hoping that there aren’t any other great changes that will affect other parts of the code. I had some issues like that with how the radiobuttons were controlled in Aspose.Cells between versions, so I guess, it’s fingers crossed on that one.

Other than that, the conversion was now successful, and another issue seems to be solved as well. When converting via the xml file, on a number of documents where the pdf had to be exactly one page long and the text was only a few characters away from going to the next page on the doc file, the produced pdf had a blank page following that. This seems to have been solved, but in order to make sure that the page count is also reported, I had to include Aspose.Pdf.Kit as well, which makes the application even larger than before for having just that functionality from that library.

Nevertheless, thanks for the help. It’s well appreciated!