Solved

Slow PDF viewing from ASP website

Posted on 2009-03-31
9
1,015 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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Read about why website design really matters in today's demanding market.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

758 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

21 Experts available now in Live!

Get 1:1 Help Now