Welcome Guest Search | Active Topics | Sign In | Register

HTMLToPDF Performance Options
primacy
Posted: Monday, March 20, 2017 1:12:20 PM
Rank: Newbie
Groups: Member

Joined: 3/20/2017
Posts: 3
Hello,

We are currently using the EO.PDF HTMLToPDF functionality to generate PDFs on two different areas of our site. One of these happens asynchronously, with a job runner taking care of the PDF generation, and one happens synchronously while the user waits for their PDF to be generated. The code in both areas to generate the PDFs is the same (one is a copy/paste of the other) but our client is finding the amount of time that it takes to synchronously generate the PDF to be unacceptable.

Does anyone have any ideas about what we can try to speed this up? I had seen a couple of posts elsewhere on the forum stating that adding some attributes to the HtmlToPdfOptions object helped to speed the process, but I tried the ones that I had seen, and none of them were helpful to me.

Has anyone seen any performance difference between HTMLToPDF and MVCToPDF? We're currently using HTMLToPDF as noted above, but could try MVCToPDF if we thought it would get us noticeable performance gains.

I'd be grateful for any suggestions that you may have.

Thanks,

Holly
eo_support
Posted: Monday, March 20, 2017 2:09:18 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,067
Hi,

The most common reason that causes delay in synchronously cases is not from the HTML to PDF converter, but from deadlocks held at various places either by your code, or by ASP.NET, or by your backend database engine. This is because the HTML to PDF converter will callback to your web server to request dependency resources used by your HTML page (JavaScript, CSS, images, etc). If your server side code already holds a lock that the dependency resources happen to need as well, then a deadlock would occur (since your calling code usually won't release the lock until the conversion is done, and the conversion won't be done until the dependency resources are successfully fetched). Both ASPXToPDF and MVCToPDF has code that tries to avoid this kind of issues, but they may not be able to avoid all cases. In that case merely switching from one method to another won't solve the problem. The best option is to try to comment out code/HTML block by block and see if you can find out exactly what triggered the delay. Usually it will make sense once you find out the trigger.

Thanks!
primacy
Posted: Monday, March 20, 2017 3:00:27 PM
Rank: Newbie
Groups: Member

Joined: 3/20/2017
Posts: 3
Hello,

Thanks for your reply!

I have now tested HTML with simply a "Hello World" HTML string with no CSS, JS, or images whatsoever and the PDF generation is just as slow, so I do not think that we're seeing the deadlock issue described. Do you have any other ideas as to common causes of performance issues that we could try?

Thank you!

Holly
eo_support
Posted: Monday, March 20, 2017 3:15:21 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,067
Hi,

For a simple "Hello World" it should not be slow. Please try to:

1. Run our EOPdfDemo application directly on your server (if possible) and see if that works differently;
2. Run the same conversion multiple times and see if subsequent conversions are faster than the first conversion (the first conversion will be notably slower since it has to initialize many internal data);

Also please use task manager to monitor CPU usage of all the processes in the system. Do you see any CPU spike while conversion is in progress?

Thanks!

primacy
Posted: Monday, March 20, 2017 4:31:33 PM
Rank: Newbie
Groups: Member

Joined: 3/20/2017
Posts: 3
Hello,

1. The EOPdfDemo application does behave differently, even when I paste the HTML we are converting directly into it - it is much, much faster.

2. Subsequent conversions are faster, but not by much. The first conversion took 35 seconds, the second took 32 seconds, and the third took 32 seconds as well.

I do not see any significant CPU spikes during the conversion process - only by about a percent or two, and CPU utilization hovers around 16% - 18% during PDF conversion.

I hope that helps.

Thank you for your time!

Holly
eo_support
Posted: Monday, March 20, 2017 5:56:19 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,067
Hi,

I can't think of any reasons that would cause such delay. How do you measure the amount of time it takes the do the conversion? Do you measure on the server side in your code or from client side browser?

Thanks
Civica Pty Ltd
Posted: Wednesday, March 22, 2017 1:46:44 AM
Rank: Member
Groups: Member

Joined: 7/9/2014
Posts: 20
Could you post some of your code?

Maybe you're having it make images alongside the PDF? (and the sample, perhaps, does not).


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.