Logo
My Account |  Site Map | Contact Us  
Welcome Guest Search | Active Topics | Sign In | Register

Taking too much time to generate PDF Options
Vinoth
Posted: Monday, March 23, 2020 11:12:42 AM
Rank: Newbie
Groups: Member

Joined: 8/28/2019
Posts: 2
I m trying to convert URL to PDF

//Convert the Url to PDF
HtmlToPdf.ConvertUrl(myURL, "c:\\test.pdf");

It is taking almost 70-90 seconds approximately in my project. But when I try the same URL in below demo link, it took me only less than 20 seconds.

https://www.essentialobjects.com/Products/EOPdf/UrlToPdf.aspx.

I m using the below snipper, I copied the EO.PDF, EO.BASE, EO.WebBrowser and EO.WebENgine as reference.


String url = reportURL;
HtmlToPdf.Options.MinLoadWaitTime = timeout;
HtmlToPdf.Options.PageSize = new SizeF(pageSizeDTO.width, pageSizeDTO.height);
HtmlToPdf.Options.OutputArea = new RectangleF(outputAreaDTO.x, outputAreaDTO.y, outputAreaDTO.width, outputAreaDTO.height);
HtmlToPdf.Options.AutoFitX = HtmlToPdfAutoFitMode.ScaleToFit;
HtmlToPdf.Options.FooterHtmlPosition = outputAreaDTO.footerPosition;
HtmlToPdf.Options.BaseUrl = baseURL;

string tempFilePath = tempPath + fileName;

HtmlToPdf.ConvertUrl(url, tempFilePath);
byte[] bytes = System.IO.File.ReadAllBytes(tempFilePath);
System.IO.File.Delete(tempFilePath);
return bytes;


Any help is appreciated!
Thanks in advance
eo_support
Posted: Tuesday, March 24, 2020 10:57:08 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 22,324
Hi,

Your code is correct. This most likely has to do with the network. In another word, it takes too much time to load all the resources you are trying to convert on your computer. Please keep in mind that the converter will wait for all dependency resources to load before start conversion. So for example, if your HTML contains a very small insignificant that takes a long time to load, then that will hold up the conversion. You can try to comment out your HTML block by block to see if you can find out which part is holding it up.

Thanks!
Vinoth
Posted: Tuesday, March 24, 2020 1:49:55 PM
Rank: Newbie
Groups: Member

Joined: 8/28/2019
Posts: 2
Thanks for the quick reply. We will try out your options. But our HTML page takes only 10 seconds to load when we browse in chrome in the same server. But the same with EO.pdf PDF generation takes more than a minute.
Does EO.pdf take care of loading the complete elements first before converting it to PDF?
When do we need to give MinLoadWaitTime?
eo_support
Posted: Tuesday, March 24, 2020 1:54:38 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 22,324
This is exactly what we were trying to tell you in our previous post.

The browser will display the page BEFORE everything is loaded.

EO.Pdf will only start conversion AFTER everything is loaded.

So the result is if there is something very small such as a minor image in your page that takes 5 minutes to load but everything else loads in 10 seconds, the the browser will display everything else immediately after 10 seconds. EO.Pdf on the other hand won't start conversion until after 5 minutes.

To resolve such issues, you need to find out what in your HTML is holding up the loading process.

MinLoadWaitTime does not have anything to do with your issue. It is used to INCREASE load time (usually to allow JavaScript code to finish running). It will only make conversion even longer.


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.