Welcome Guest Search | Active Topics | Sign In | Register

PDF file not coming up after long generation Options
Buffini & Company
Posted: Monday, December 3, 2012 1:48:36 PM
Rank: Newbie
Groups: Member

Joined: 12/3/2012
Posts: 6
We are building a larger PDF document (200+ pages). It takes several minutes to generation the html first to send to the PDF builder. Problem is when we try to output it to the browser nothing every gets sent. It works fine when there are less pages, like 100 pages, but as you get up in the range of 200 or higher nothing ever pops up on the browser to download.

Here is our code:

Code: Visual Basic.NET
EO.Pdf.HtmlToPdf.ConvertHtml(BodyContent, doc)

Response.Clear()
Response.ContentType = "application/pdf"
Response.AddHeader("Content-Disposition", "attachment; filename=letter" + DateTime.Now.ToShortTimeString().Replace(":", "").Replace(" ", "") + ".pdf")

doc.Save(Response.OutputStream)
Response.End()
eo_support
Posted: Monday, December 3, 2012 4:50:28 PM
Rank: Administration
Groups: Administration

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

Your code is fine. The problem is ASP.NET would kill your request if it detects that it takes too long to complete. You can Google httpRuntime executionTimeout and that should give you detailed information about how to change this.

Thanks!
Buffini & Company
Posted: Monday, December 3, 2012 5:22:27 PM
Rank: Newbie
Groups: Member

Joined: 12/3/2012
Posts: 6
Thanks. Let me try it out.

BTW - we tried several PDF components and your guy's one is by far the best for converting HTML to PDFs.
Buffini & Company
Posted: Monday, December 3, 2012 7:44:31 PM
Rank: Newbie
Groups: Member

Joined: 12/3/2012
Posts: 6
Hi, I tried this and it still would not come up. Set executionTimeout="43200" in the web.config. Our application is hosted on Windows Azure, a webfarm, do you know if that would affect anything?
eo_support
Posted: Monday, December 3, 2012 8:20:44 PM
Rank: Administration
Groups: Administration

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

Glad to hear that you think we are best. We think so too. ;)

Unfortunately we are not expert about Windows Azure web farm. So you might want to contact your service provider about this. In order to reproduce the problem, try to change your code to read from a static PDF file and then send it to the OutputStream, but add Thread.Sleep to extend the time of the request. We believe this is the only factor that's causing the problem for you.

Thanks!
Buffini & Company
Posted: Tuesday, December 4, 2012 12:27:31 PM
Rank: Newbie
Groups: Member

Joined: 12/3/2012
Posts: 6
Did some more testing. If we start the generation the close the browser before its finished, we get this error (via our error email system) after a bit:


Error Message:
The remote host closed the connection. The error code is 0x800704CD.

Stack Trace:
at System.Web.Hosting.IIS7WorkerRequest.RaiseCommunicationError(Int32 result, Boolean throwOnDisconnect) at System.Web.Hosting.IIS7WorkerRequest.ExplicitFlush() at System.Web.HttpResponse.Flush(Boolean finalFlush) at WebRole1.CampaignWork.btnPrintLetterPDF_Click(Object sender, EventArgs e) at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)


This happens when it tries to send the file and the recipient is no longer connected. This is as expected since the browser was closed. But it does show that the connection is not timing out if the browser was still open. So I am still not sure why the PDF isnt getting sent. Will keep trying things.


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.