?
Solved

Slow PDF viewing from ASP website

Posted on 2009-03-31
9
Medium Priority
?
1,029 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 

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

Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

Question has a verified solution.

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

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
The viewer will learn how to count occurrences of each item in an array.
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…
Suggested Courses

752 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