Welcome Guest Search | Active Topics | Sign In | Register

Operation Timeout HTML to PDF Options
Gafa
Posted: Wednesday, May 25, 2011 10:41:18 AM
Rank: Newbie
Groups: Member

Joined: 5/23/2011
Posts: 6
Operation times out.

at EO.Pdf.HtmlToPdfException.b(Exception A_0) at EO.Pdf.Internal.j2.d() at EO.Pdf.HtmlToPdf.a(j2 A_0) at EO.Pdf.HtmlToPdf.ConvertHtml(String html, PdfDocument doc) at EO.Pdf.HtmlToPdf.ConvertHtml(String html, String pdfFileName)

Happens on a large HTML post.

Code I'm using:

string sTemp = pSB.ToString();
string sImageFilePath = ConfigurationManager.AppSettings["LocalTempImageFilePathBaseUrl"];
string sPDF_File=ConfigurationManager.AppSettings["PDF_FileCreatePath"]+DateTime.Now.Ticks.ToString()+".pdf";

HtmlToPdf.Options.BaseUrl = sImageFilePath;
HtmlToPdf.Options.PageSize = new SizeF(8.5f, 11f);
HtmlToPdf.ConvertHtml(sTemp, sPDF_File);
eo_support
Posted: Wednesday, May 25, 2011 10:54:30 AM
Rank: Administration
Groups: Administration

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

You can try to increase HtmlToPdf.Options.MaxWaitTime and see if that helps. If that does not, see if you can split the big HTML text into small segments and find out which part is causing time out. If it times out regardless, you can try to isolate the problem into a test project and send to us (let us know if that's the case so that we can let you know where to send). Once we have that we will look into it immediately and see what we can do.

Thanks!
Gafa
Posted: Wednesday, May 25, 2011 11:02:06 AM
Rank: Newbie
Groups: Member

Joined: 5/23/2011
Posts: 6
Is the maxLoadWaitTime in seconds, minutes...?

thanks

Gafa
eo_support
Posted: Wednesday, May 25, 2011 11:05:04 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Gafa
Posted: Wednesday, May 25, 2011 12:00:33 PM
Rank: Newbie
Groups: Member

Joined: 5/23/2011
Posts: 6
Setting the MaxLoadwaitTime just creates a new error:

Exception of type 'System.OutOfMemoryException' was thrown.

at EO.Pdf.HtmlToPdfException.b(Exception A_0) at EO.Pdf.Internal.j2.d() at EO.Pdf.HtmlToPdf.a(j2 A_0) at EO.Pdf.HtmlToPdf.ConvertHtml(String html, PdfDocument doc) at EO.Pdf.HtmlToPdf.ConvertHtml(String html, String pdfFileName)

The html isn't very large, but it does have about 50 images. If I reduce the image size (width/height) not byte size, they are only 20-25k then the errors go away, but also then my images are much smaller than needed. I'll try to play around with this, but there still is an underlying issue.

thanks

Gafa

eo_support
Posted: Wednesday, May 25, 2011 12:11:07 PM
Rank: Administration
Groups: Administration

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

Huge images are a bit tricky because the amount of buffer needed to decode/encode/render them. The most reilable way is to split them into small chunks and then run ConvertHtml once for each chunk (ConvertHtml can continue output on the same page, so the chunks do not have to be on separate pages. In another word, you do not need to know where to page). You can also save each conversion’s result as a separate pdf file and then call PdfDocument.Merge to merge them into a single file once you are done with all the small files.

Another thing you can try is to reduce the image resolution. Most high quality images are at least 300 DPI. However screen is typically only 96 DPI, which is more than enough produce good result for human eyes on screen. So if your PDF file is primarily for viewing, then you do not need resolution higher than 96 DPI. Reducing the DPI will not reduce the image's dimension (width/height), but will reduce the data amount significantly.

Hope this helps. Please let us know if it works for you.

Thanks!
Gafa
Posted: Wednesday, May 25, 2011 2:22:19 PM
Rank: Newbie
Groups: Member

Joined: 5/23/2011
Posts: 6
Thank you for the suggestions.

I have reduced the images width/height to an acceptable level, the images already are 96 DPI. I'll try the chunk method seems like that is the best fit.

thanks

Gafa
eo_support
Posted: Wednesday, May 25, 2011 2:32:08 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
OK. Let us know if you need any more help from us on that.

Thanks!
shami
Posted: Tuesday, June 19, 2012 4:51:28 PM
Rank: Newbie
Groups: Member

Joined: 6/19/2012
Posts: 2
i m also getting this exception
how to increase HtmlToPdf.Options.MaxWaitTime
i m trying to convert a aspx page url placed on my on computer

HtmlToPdf.ConvertUrl("~/mywork/chart.aspx", "d:\\test.pdf");

but other url like http://www.google.com.pk is working fine

i read all comments above but unable to find method to increase MaxWaitTime
does increasing MaxWaitTime will resolve my problem?? can anyone help
i also visited
http://doc.essentialobjects.com/library/4/eo.pdf.htmltopdfoptions.maxloadwaittime.aspx
eo_support
Posted: Tuesday, June 19, 2012 5:31:37 PM
Rank: Administration
Groups: Administration

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

You can not use root relative path such as "~". Only ASP.NET knows how to interpret that. Using our component inside an ASP.NET application does not mean our component will understand everything ASP.NET understands.

If you changed the path and still gets time out, see here for more details:

http://www.essentialobjects.com/doc/4/web/aspxtopdf.aspx#debug

Thanks!
shami
Posted: Monday, June 25, 2012 4:59:12 AM
Rank: Newbie
Groups: Member

Joined: 6/19/2012
Posts: 2
thanx sir. i got it..
i was actually using html to pdf command instead of aspx to pdf,
thanks..your product rocks


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.