Free Support Forum - aspose.com

Convert XML to PDF hangs

Hi, I am trying to convert a system generated XML file to PDF using Aspose.Words (11.8.0.0) and the process hangs on the Document.Save method. Task manager shows that the process is doing something but there is no error and after an hour it has still not completed.

My code:

Document doc = new Document(sourceFile);

doc.Save(destinationFile, SaveFormat.Pdf);

The content of the XML file is:

<?xml version="1.0" encoding="utf-8"?>





















<?xml version="1.0" encoding="utf-8"?>

Thanks


Hi Leigh,

Thanks for your inquiry. Please note that Aspose.Words mimics the same behavior as MS Word do. Aspose.Words supports WordML format (Microsoft Word 2003 WordprocessingML format). Please read Aspose.Words LoadFormat and SaveFormat Enumeration for your kind reference. I have attached a sample WordML file with this post. Please use WordML file for PDF conversion. Hope this answers your queries. Please let us know if you have any more queries.


Hi Tahir,

If I understand your post correctly, you want me to change the format of the xml file? if this is the case then that is not possible - we do not have control over the xml format/content, we simply need to convert any xml file given to us into pdf.

I was hoping there was a way of converting it as if it were a simple text file i.e. no parsing or schema validation - simply convert the text to pdf.

I did modify my code as you suggested (using LoadFormat/SaveFormat) but the issue remains - when the save method is called the application hangs, no error.

Thanks

Hi Leigh,


Thanks for your inquiry. In this case, you can easily read XML in c# code and write the contents of XML into Word document by using DocumentBuilder.write method. I suggest you, please read following documentation links for your kind reference.
http://www.aspose.com/docs/display/wordsnet/DocumentBuilder+Overview
http://www.aspose.com/docs/display/wordsnet/Using+DocumentBuilder+to+Modify+a+Document+Easily

Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.

Hi Tahir,


Tried what you suggested - still fails with same issue when trying to convert the document to PDF. I have attached two files which cause this problem. Can you please check.

Thanks

Hi Leigh,


Thanks for sharing the files. I have tried to convert shared TXT file to PDF by using Aspose.Words. It freezes while conversion. I have used the following code snippet to reproduce this issue. I have logged this issue as WORDSNET-7283 in our issue tracking system. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved. We apologize for your inconvenience.

If you are not facing the same issue, please share your scenario here for investigation purposes.

<span style=“font-size:10.0pt;
font-family:“Courier New”;color:#2B91AF;mso-font-kerning:0pt;mso-ansi-language:
PL;mso-no-proof:yes”>LoadOptions<span style=“font-size:10.0pt;
font-family:“Courier New”;mso-font-kerning:0pt;mso-ansi-language:PL;mso-no-proof:
yes”> opt = new LoadOptions();<o:p></o:p>

opt.LoadFormat = LoadFormat.Text;

opt.Encoding = Encoding.Unicode;

Document doc = new Document(MyDir + "Test24.txt", opt);

doc.Save(MyDir + "AsposeOut.tiff");


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


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