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"?>
<!--_SIG=hVop9sj98oFcJwLNmW/eXrL6G8CAS1JLwvyGBRuuO281Skm9lqYqiCtEoJ8j1rtR1ZYF2tgCeNaSew24pPIhzWuM+mQmK0pr2QQEoZ687VprKDgn5TBUK4QmPun3RcQZEJa/zo9IdLV4JkKNTJQ23QAJstPtk0ld6pFzgNFEyUQ=-->
<Setup Id="PowerPoint.en-us" Type="AddOn" Keyword="PowerPointMUI" Culture="en-us">
 <Option Id="AlwaysInstalled" DefaultState="Local" DisallowAbsent="yes" DisallowAdvertise="yes" Hidden="yes"/>
 <Option Id="Gimme_OnDemandData" DefaultState="Local" DisallowAbsent="yes" DisallowAdvertise="yes" Hidden="yes"/>
 <Option Id="ProductFiles" DefaultState="Local" DisallowAbsent="yes" DisallowAdvertise="no">
  <Option Id="PPTFiles" DefaultState="Local" DisallowAbsent="no" DisallowAdvertise="no">
   <Option Id="OrgChartFiles" DefaultState="Absent" DisallowAbsent="no" DisallowAdvertise="yes"/>
   <Option Id="PPTPresentationTemplates" DefaultState="Local" DisallowAbsent="no" DisallowAdvertise="yes" Hidden="yes">
    <OptionDependency Lead="PPTFiles"/>
   </Option>
   <Option Id="PPTHelpFiles" DefaultState="FollowParent" DisallowAbsent="yes" DisallowAdvertise="no" Hidden="yes"/>
   <Option Id="PPTViewerFiles" DefaultState="FollowParent" DisallowAbsent="no" DisallowAdvertise="no" Hidden="yes"/>
  </Option>
 </Option>
 <PackageRef Path="PowerPointMUI.xml"/>
 <LocalCache DownloadCode="{90120000-0018-0409-0000-0000000FF1CE}" SkuComponentDirectory="PowerPoint.en-us">
  <File Id="PowerPointMUI.xml" MD5="60E3A15C790BBD6593CEB43E7E47678E" Size="1553" RelativeCachePath="PowerPointMUI.xml" RelativeSourcePath="PowerPointMUI.xml"/>
  <File Id="PowerPointMUI.msi" MD5="9CD76EACC2AF6BDEA5342372FF6807EB" Size="1642496" RelativeCachePath="PowerPointMUI.msi" RelativeSourcePath="PowerPointMUI.msi"/>
  <File Id="PptLR.cab" MD5="8306A40E1C406681A3099D3A20FF3969" Size="13422356" RelativeCachePath="PptLR.cab" RelativeSourcePath="PptLR.cab"/>
  <File Id="Setup.xml" MD5="" Size="" RelativeCachePath="Setup.xml" RelativeSourcePath="Setup.xml"/>
 </LocalCache>
</Setup>

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.
https://docs.aspose.com/words/net/document-builder-overview/
https://docs.aspose.com/words/net/document-builder-overview/

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.

LoadOptions opt = new LoadOptions();
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.