Convert Save As HTML File into XPS Format using C# .NET API Code | Paragraph with Many Line Breaks

Why an html that is opened in Aspose.words take so long to save as Xps file.

I am missing a configuration or something.

Hi

Thanks for your inquiry. It takes longer than converting to Word formats because converting to XPS requires rendering document, i.e. Aspose.Words should layout document into pages.
Best regards.

But a simple html file with only text it’s taking more than 30 minutes to convert.

Hi

Thank you for additional information. Could you please attach the HTML document you are getting problem with? I will check it on my side and provide you more information.
Best regards,

Hi
Thank you for additional information. I managed to reproduce the problem on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is fixed.
It seems the reason of the problem is lot of
tags inside the document. So you can try using the following workaround:

DateTime p0 = DateTime.Now;
string html = File.ReadAllText(@"Test006\longtxt_CONVERTED.html");
html = html.Replace("<br>", "<p>");
MemoryStream strm = new MemoryStream(Encoding.UTF8.GetBytes(html));
DateTime p1 = DateTime.Now;
Console.WriteLine("Replacing: {0} sec", (p1 - p0).TotalSeconds);
Document doc = new Document(strm);
DateTime p2 = DateTime.Now;
Console.WriteLine("Loading: {0} sec", (p2 - p1).TotalSeconds);
doc.UpdatePageLayout();
DateTime p3 = DateTime.Now;
Console.WriteLine("Layout: {0} sec", (p3 - p2).TotalSeconds);
doc.Save(@"Test006\out.xps");
DateTime p4 = DateTime.Now;
Console.WriteLine("Saving: {0} sec", (p4 - p3).TotalSeconds);

Best regards,

The issues you have found earlier (filed as 18910) have been fixed in this update.

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

The issues you have found earlier (filed as WORDSNET-3738) have been fixed in this Aspose.Words for .NET 19.5 update and this Aspose.Words for Java 19.5 update.