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

Free Support Forum - aspose.com

Performance issue when building PDF with HTML tags


We are having performance issues when creating PDF document with supported HTML tags. Generating PDF with API only is 7 time quicker than building with HTML.

Please see example code, if ‘IsTrueTypeFontBold’ is true generation time is 7 times longer.

Is there any work scheduled to fix this problem?

We use v7.7.0.0 updating to v8.0.0.0 doesn’t make much difference (actually it takes slightly longer).

Aspose.Pdf.Generator.Text text = new Text(FormatText(value));
text.Margin.Top = 10;
TextInfo textInfo = new TextInfo();
textInfo.FontName = “Arial”;
textInfo.FontSize = 12F;
textInfo.IsTrueTypeFontBold = false;
text.IsHtmlTagSupported = supportHtml;
text.TextInfo = textInfo;


Hi Marcin,

Thanks for using our products.

I have tested the scenario using following sample code and I am unable to notice any performance related issue when setting value of IsTrueTypeFontBold true or false. May be the performance related issue is occurring with the HTML string which you are trying to convert. Can you please share the complete code snippet which can help us in replicating this issue at our end. We are sorry for this inconvenience.

Hi! The problem is really with the HTML. Below is the sample code I used. When the property IsHtmlTagSupported is set to true, it takes 43 seconds and when it is set to false, it takes 0.5 second. We have reports in our application that are taking a minute or two and it is related to that. The problem is present in version 8.0 but everything is fine in version 6.4 (I know it’s really old but that’s what we were using before our upgrade to 8.0).

Sample code:
public static void PerfIssueWithHtml()
Pdf pdf = new Pdf();
Section section = new Section(pdf);
section.IsLandscape = true;

foreach (bool htmlSupported in new bool[] { true, false })
for (int i = 0; i < 100; i++)
section.Paragraphs.Add(new Text(“I am a regular text”));
section.Paragraphs.Add(new Text(“I am an HTML text”) { IsHtmlTagSupported = htmlSupported, UseTextInfoStyle = true });

string filename = htmlSupported ? @“d:\PerfIssueWithHtml.pdf” : @“D:\WithoutHTML.pdf”;
Stopwatch timer = Stopwatch.StartNew();
Console.WriteLine(“Time taken to generate : {0} ms”, timer.ElapsedMilliseconds);

Hi Marcin,

Thanks for sharing the code snippet.

<span style=“font-size:10.0pt;font-family:“Arial”,“sans-serif””>I
have tested the scenario and I am able to reproduce the same problem. For the
sake of correction, I have logged it in our issue tracking system as PDFNEWNET-35357. We
will investigate this issue in details and will keep you updated on the status
of a correction. <o:p></o:p>

We apologize for your inconvenience.

The issues you have found earlier (filed as PDFNEWNET-35357) have been fixed in Aspose.Pdf for .NET 8.3.0.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.