Slow performance while converting html to pdf in .net

I am working on the Aspose.Pdf library (version 11.3.0.0) to convert html to pdf.

The result in pdf looks really nice, but the conversion is very slow.

Depending on the size of the html it takes about 7 seconds to generate 1 pdf (on 1 thread).

The code we use to convert it to html:

private static void CreatePdf()

{

Aspose.Pdf.License pdflicense = new Aspose.Pdf.License();

pdflicense.SetLicense(@“Aspose.Pdf.lic”);

pdflicense.Embedded = true;

Stopwatch sw = new Stopwatch();

sw.Start();

HtmlLoadOptions hlo = new HtmlLoadOptions();

hlo.PageInfo.Margin.Left = 20;

hlo.PageInfo.Margin.Top = 10;

hlo.PageInfo.Margin.Right = 15;

hlo.PageInfo.Margin.Bottom = 30;

Document doc = new Document(“Form_2.html”, hlo);

Page p = doc.Pages[2];

p.PageInfo.Margin.Top = 0;

p.PageInfo.Margin.Bottom = 0;

p.PageInfo.Margin.Left = 10;

p.PageInfo.Margin.Right = 0;

doc.Save(“Pdf\output.pdf”);

Console.WriteLine($“Ellapsed {sw.ElapsedMilliseconds} ms”);

sw.Stop();

}

Do you know if there is a way to increase this performance?

@cvalingam

Would you please try using latest version i.e. Aspose.PDF for .NET 19.6 to convert HTML to PDF as it is always recommended to use latest version. In case you still face any issue, please share your sample HTML string or file in ZIP format with us. We will test the scenario in our environment and address it accordingly.

https://1drv.ms/u/s!AoqYQ7s61BnOpo853cg9hPQmxHGSww?e=mu7ZTZ

Please find the above sample link and check with the latest version of your dll and let me know the performance.

Thanks and regards,
Sivalingam

@cvalingam

We have tested the scenario in our environment and observed that API took more than 40 seconds to convert result.html into PDF document. We have created an issue as PDFNET-46641 in our issue tracking system. We will further look into details of the issue and keep you posted with the status of its correction. Please be patient and spare us little time.

We are sorry for the inconvenience.

Any update on this ticket PDFNET-46641 please?

@AmritaJayabal

The issue is not yet resolved due to low priority. As it was logged under free/normal support model, it will be investigated and resolved on first come first serve basis. We will surely let you know as soon as there is some news on its resolution. Please give us little time.

We are sorry for the inconvenience.

@asad.ali

Hey Aspose,

Is this thread dead? Do I need to open a separate ticket for same problem?
How come this is a low priority?

Thinking about the thousands of dollars company is paying for the licensee this is unacceptable in comparison with other free of charge solutions that work 5x times faster.

I have a document of 180 pages, 3 images on first page and on last page, images are loaded from disk and custom font, final pdf file is around 2MB, runs on .net core 2.2, tried with last 10 nuget packages and same result.

Is something planed for this? If not, my advice for the company is to ditch aspose PDF being quite pricey for very little.

Thank you.

@Dude_D

Thank you for contacting support.

We recommend creating separate tickets where one can refer to another ticket if related. However, would you please share source and generated files as ZIP, along with SSCCE code so that we may investigate accordingly.

The issues you have found earlier (filed as PDFNET-46641) have been fixed in Aspose.PDF for .NET 23.3.