Solved

Slow PDF viewing from ASP website

Posted on 2009-03-31
9
1,017 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
 

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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Read about why website design really matters in today's demanding market.
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

911 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now