|
Rank: Newbie Groups: Member
Joined: 7/17/2023 Posts: 3
|
Hi.
We are trying to speed up process of Pdf generation from URL. We did some tests and most of the time is spent on waiting for page to be ready.
At first I thought about cache, but did not find many options to manage caching process. I tried to set UseCache = true, and tried to set Cache folder, but seems like nothing changed. It seems like it worked a little slower with cache folder set (maybe something was wrong with tests).
I checked documentation of EoPdf and didn't find anything that could be helpful. Is there any settings that could be useful? Or maybe you have some tips you can share?
Best regards.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi,
All the caches are already on by default. However whether cache are used for a specific request is determined by the server (HTTP headers sent back by the server). Because EO.Pdf will wait until ALL resources in the page to finish loading first, so even if one resource that is not cached and takes a long time it can hold up the whole process. It is not uncommon at all that some resources in the page are not cached. For example, a website that uses JavaScript to track traffic information (such as site that uses Google Analytics) would always try to post some information back to the trafic tracking site to report visiting information. In such cases the site will not be considered "finished loading" until such process is done. Obviously because this is real time traffic reporting, it can not be cached.
If this is the case, you can use a traffic monitor to examine the HTTP traffic to find out exactly what requests are holding up the process. You can then determine whether these requests are important. For example, if you are trying to convert a page with dynamically generated map/chart, then obviously you will have no choice but to wait for the map/chart to be fully generated. However for requests that does not impact visual result in anyway (such as traffic reporting requests), you can simply disable them. These are multiple ways to disable a request sent by the HTML to PDF converter. One easy way is to configure your server's HOSTS file to point the corresponding server to nowhere. For example, if the site uses Google Analytics and it's the request that reports back to GA's server that takes a long time, you can configure your HOST file to point all GA servers to something like 127.0.0.1 (localhost). These way these requests will fail right away.
If you need fine control instead of failing all requests to a specific server, you can use a custom resource handler and choose to fail only specific requests through your custom resource handler. You would need to use a HtmlToPdfSession object for this purpose. If you choose this option and would like more information on how to use this option, please let us know and we will be happy to assist you further.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 7/17/2023 Posts: 3
|
Hi, thank you for information.
Could you explain how can I check which requests stops Eo.Pdf to start printing. Is traffic monitor a part of your API or should I use some tool?
Also does Eo.Pdf wait for resources if I set trigger to manual?
Regards.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
No. You can use any third party traffic monitor application. Fiddler is a popular one. You can also use Google Chrome to load the same page and then use DevTools in Google Chrome to view resource loading time in order to find out the bottle neck resources. Additionally, you can manually modify your input HTML and just use old trial and error way to find out which resource is causing delays.
EO.Pdf does not wait for all resources if you set trigger mode to manual.
|
|
Rank: Newbie Groups: Member
Joined: 7/17/2023 Posts: 3
|
Thank you for your support.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
You are very welcome. Please feel free to let us know if there is anything else.
|
|