|
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()
|
|
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!
|
|
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.
|
|
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?
|
|
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!
|
|
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.
|
|