Solved

Slow PDF viewing from ASP website

Posted on 2009-03-31
9
1,018 Views
Last Modified: 2012-05-06
I have an ASP.NET website that generates a PDF using Active Reports' PDFExport.  The PDF then opens in a new window.

Unfortunately this process is very slow and is being used in a hospital environment where quick results are needed.  I am looking for any suggestions on how to get this PDF displaying as quickly as possible (even in the same window/page?).

I am also looking at the possibility of skipping the view stage altogether and taking the user straight to the print dialog.  I've done this before in WinForms, but can I pull it off in web?

Included below is the current code.
this.pdfExport1.Security.Encrypt = true;
this.pdfExport1.Security.Permissions = DataDynamics.ActiveReports.Export.Pdf.PdfPermissions.AllowPrint;
this.pdfExport1.Export(rpt.Document, m_stream);
m_stream.Position = 0;
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "inline; filename=MyExport.pdf");
Response.BinaryWrite(m_stream.ToArray());
Response.End();

Open in new window

0
Comment
Question by:corebiz
  • 5
  • 4
9 Comments
 
LVL 23

Expert Comment

by:apresto
ID: 24029361
hi corebiz,
Is the PDF generation process happening in the new window, or in the page that spawns the new window?
Is it taking time actually generating the PDF or just when it comes to showing it?
What is the size of an average PDF?
0
 

Author Comment

by:corebiz
ID: 24029440
I'm not a master at these things, but I'm fairly confident the generation is happening in the existing/old window, and once ready is opening in a new window.

I have two different pages generating PDF's.  The one generates a one-page PDF that generates reasonably quickly and the delay is purely in opening the new window or the gadget that shows the PDF (adobe or foxit reader).

The other generates a multi-page PDF, which is running extraordinarily slowly (4 minutes for 10 pages), so it surely must be my fault somewhere.  This one is not going to a new window but is popping up for download, although I'd like it to jump directly to a print dialogue.
0
 
LVL 23

Expert Comment

by:apresto
ID: 24029492
What are the sizes of the 2 different types (single page and 10 page PDF's)
If you are confident that the generation of the 1page PDf is ok, you have to remember, that when it is opened in a new windows, the PDF is downloaded to the client in its entirety to allow them to view it. So prompt or shown the same thing will happen
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

Author Comment

by:corebiz
ID: 24029746
The single page is only 22k.  The 10 page is taking 4 minutes when I view it live, but on my development machine it takes 20 seconds to generate 129 pages into a 304kb file.  The latter is tolerable, the former not.
0
 
LVL 23

Expert Comment

by:apresto
ID: 24030610
how is th PDF being populated when it is generated, from a database?
You say its ok on your local machione, are you using a local database to do this or linking to your live one?
If yo are using SQL Server check the indexes on the table used to populate the fields in your PDF document.
0
 

Author Comment

by:corebiz
ID: 24031254
I can certainly investigate that kind of thing.  What I'm more interested in is quick ways to display PDF's in a webpage.  Can you give any insight on this or are you aware of any controls that can dock into an ASP.Net page to display PDFs?
0
 
LVL 23

Expert Comment

by:apresto
ID: 24035027
Im not aware of any. Have a look here, you may be able to take something from it to help:
http://www.codeproject.com/KB/aspnet/HTML2PDF.aspx
To be honest, if they are small, they shouldnt take that long to load at all. Obviously they are taking a long time to process on your live server and this is a problem in itself
0
 

Accepted Solution

by:
corebiz earned 0 total points
ID: 24075506
For anyone with the same problem, see the response I got from the ActiveReports guys:

http://www.datadynamics.com/forums/122279/ShowPost.aspx#122279
0
 
LVL 23

Expert Comment

by:apresto
ID: 24084931
Thanks for sharing, glad you got it sorted :)
0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question