473,770 Members | 2,135 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Open a "Generated" PDF

Framework: Visual Studio 2005
Technology: ASP.NET 2.0
Language: C#.NET 2.0

Hi All,

I have an in-built tool to generate PDF Reports.
Once a PDF Report is generated, I have provided an option of "Viewing" the
PDF as well.
Now, once there is a large PDF being generated (say a PDF of 70 Pages or so)
and I try to "View" the PDF then it fails to do so.
The reason being, my code is actually trying to view a PDF File which is
still in the "building" stage and not a completely "built" PDF.

How do I programmaticall y put a delay into my code so that the process of
"Viewing" the PDF doesnot hang and show the PDF file successfully.

Here is what I have at present to "View" the PDF.
protected void lnkViewPdf_Clic k(object sender, EventArgs e)

{

string jScript;

jScript = "<script>window .open('" +
Request.Applica tionPath.ToStri ng().ToLower() + stringPDFUrl +
"','','','' )</script>";

Page.RegisterCl ientScriptBlock ("keyClientBloc k", jScript);

lnkViewPdf.Visi ble = false;

}

Please help me how would I tweak the code so that there is a delay while
"Viewing the PDF" just after the PDF is generated.

Any leads on this would be very helpful.

Thanks in advance,
Kuldeep
Jun 14 '07 #1
2 1623
instead of opening the pdf directly, open an asp.net page that delays
until the pdf is built then redirects to it. if the wait is very long
(over a second or two), have the page do a meta refresh and display a
working... gif.
-- bruce (sqlwork.com)
Kuldeep wrote:
Framework: Visual Studio 2005
Technology: ASP.NET 2.0
Language: C#.NET 2.0

Hi All,

I have an in-built tool to generate PDF Reports.
Once a PDF Report is generated, I have provided an option of "Viewing" the
PDF as well.
Now, once there is a large PDF being generated (say a PDF of 70 Pages or so)
and I try to "View" the PDF then it fails to do so.
The reason being, my code is actually trying to view a PDF File which is
still in the "building" stage and not a completely "built" PDF.

How do I programmaticall y put a delay into my code so that the process of
"Viewing" the PDF doesnot hang and show the PDF file successfully.

Here is what I have at present to "View" the PDF.
protected void lnkViewPdf_Clic k(object sender, EventArgs e)

{

string jScript;

jScript = "<script>window .open('" +
Request.Applica tionPath.ToStri ng().ToLower() + stringPDFUrl +
"','','','' )</script>";

Page.RegisterCl ientScriptBlock ("keyClientBloc k", jScript);

lnkViewPdf.Visi ble = false;

}

Please help me how would I tweak the code so that there is a delay while
"Viewing the PDF" just after the PDF is generated.

Any leads on this would be very helpful.

Thanks in advance,
Kuldeep

Jun 14 '07 #2
"Kuldeep" <ku************ ****@hotmail.co mwrote in message
news:ub******** ******@TK2MSFTN GP06.phx.gbl...
I have an in-built tool to generate PDF Reports.
Once a PDF Report is generated, I have provided an option of "Viewing" the
PDF as well.
Now, once there is a large PDF being generated (say a PDF of 70 Pages or
so) and I try to "View" the PDF then it fails to do so.
The reason being, my code is actually trying to view a PDF File which is
still in the "building" stage and not a completely "built" PDF.

How do I programmaticall y put a delay into my code so that the process of
"Viewing" the PDF doesnot hang and show the PDF file successfully.
I've had similar issues in the past...

Does your PDF generation tool return a value when it finishes? How are you
calling it? Can it be configured to create a zero-byte file after it's
created the PDF?
jScript = "<script>window .open('" +
Request.Applica tionPath.ToStri ng().ToLower() + stringPDFUrl +
"','','','' )</script>";

Page.RegisterCl ientScriptBlock ("keyClientBloc k", jScript);
Also, since you're using ASP.NET 2, you should be using
ClientScript.Re gisterClientScr iptBlock, as Page.RegisterCl ientScriptBlock is
now obsolete:
http://msdn2.microsoft.com/en-us/lib...ck(VS.71).aspx
http://forums.microsoft.com/msdn/Sho...15280&SiteID=1

In addition, that has an additional boolean argument which you can set to
true so that it creates the <scripttags automatically.. .

If want to continue with the obsolete class, consider changing the first
line of the JavaScript to:
jScript = "<script type="text/javascript">win dow.open('" +

so that at least your code is standards compliant...
--
http://www.markrae.net

Jun 14 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2079
by: Jane T | last post by:
is there someone who has used a tool to poplate a database schema with about 1M rows in the main table, where it is a controlled population (not strictly random)? we want to test our DB perf with an application, but we need meaningful data so that we can test for real-life scenarios. any help would be appreciated.
17
4724
by: Darek | last post by:
Hi, I have a table, something similar to: create table my_table ( id char(32) not null primary key, num integer not null, code varchar(2) not null, name varchar(60) not null,
11
5979
by: Jan | last post by:
I'm using the CSharpCodeProvider to buils some assemblies @ runtime which are never saved as files (cp.GenerateInMemory = true;). The generated assemblies are hierachically dependent on each other so I generate the "bottom" assemblies first. How do I add a dependency to another previously loaded (generated) assembly? I would be happy if CompilerParameters.ReferencedAssemblies.Add could take a System.Reflection.Assembly reference as...
2
1647
by: Jan | last post by:
Regarding my post "CSharpCodeProvider: referencing other generated "InMemory" assembly" 4/27/2006 and the blog from Greg Young http://geekswithblogs.net/gyoung/archive/2006/04/27/76533.aspx I have now implemented a fine system with code semilar to Greg's example code. I have a warning/comment/question: When the generated main assembly is called for the first time (in my application a static initialize function) another instance of...
0
9425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10057
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10002
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8883
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7415
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6676
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3970
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.