473,398 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Open new window and display PDF document...

Hello,

I would like to be able to open a new IE window on the client side and
display a PDF document in the new window. Many tutorial sites that I have
checked suggest opening a new IE window using client-side JavaScript and the
window.open() function. I suspect this is not the desired way as I would
like to output a PDF report from a byte array to the HTTP output stream to
this new window.

Any ideas?

TIA...
Jun 27 '08 #1
2 8459
Generating byte array/stream on the web server and open new browser window
are two different things. No, you cannot open new browser window with server
side code. New browser winodw is open opened by user action explicitly
(clicking a button/link, which calls client javascript code
"widow.open('pageaddress');". So, you can use your server side code to
attach similar client side javascript code to a button/link, in which you
can specify the page that is generating PDF stream.

"H. Rodriguez" <hr********@hotmail.comwrote in message
news:aa******************************@giganews.com ...
Hello,

I would like to be able to open a new IE window on the client side and
display a PDF document in the new window. Many tutorial sites that I have
checked suggest opening a new IE window using client-side JavaScript and
the window.open() function. I suspect this is not the desired way as I
would like to output a PDF report from a byte array to the HTTP output
stream to this new window.

Any ideas?

TIA...
Jun 27 '08 #2
You're on the right track, but you'll also need to use
Page.ClientScript.RegisterStartupScript.

e.g. user clicks a "show document" button.
On server side, use ClientScript.RegisterStartupScript to register the
javascript which you want to automatically run on the client.
Write the javascript so that it opens a new brower window (using window.open
etc) at the new page which you will use to display the PDF.

On the new PDF page, do something like this to display the PDF in the
Page_Load event :

byte[] data = ... fill with PDF data
Response.Clear();
Response.ContentType = "application/pdf";
Response.BinaryWrite(data);
Response.End();

"H. Rodriguez" <hr********@hotmail.comwrote in message
news:aa******************************@giganews.com ...
Hello,

I would like to be able to open a new IE window on the client side and
display a PDF document in the new window. Many tutorial sites that I have
checked suggest opening a new IE window using client-side JavaScript and
the window.open() function. I suspect this is not the desired way as I
would like to output a PDF report from a byte array to the HTTP output
stream to this new window.

Jun 27 '08 #3

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

Similar topics

1
by: Matt | last post by:
My problem is when the user click the submit button, it will launch another new window for the request page. I want to confirm we cannot use JavaScript open window functions to open a request page?...
1
by: Winfried Koenig | last post by:
Hi everyone, I have a main page: -------------------------------------------------- <html><head><title>Test</title> </head><body> <img id="img_a" name="img_a" src="image_1.png" alt=""><br>
3
by: Hermit Crab | last post by:
I'm seeing some unexpected (at least to me) behavior in the 'window' and 'document' objects under Netscape 7.1 and Internet Explorer 6.0. When a property is added to the prototype for 'Object',...
2
by: dan | last post by:
This works in mozilla but I can't figure out why this won't work in IE. Say I have this html <html> header goes here header goes here
4
by: Anna Quick | last post by:
I am quite new to javascript, and don't seem to find the problem with stupid internet explorer. The script works fine in safari and mozilla. I searched the groups, but evidently put in the wrong...
3
by: NeverLift | last post by:
But, if it's not open, I don't want to open it . . . using window.open will open it if it doesn't exist, even if the url in that open is null (the window is then empty -- but it's open). The...
29
by: wayne | last post by:
Hey there... I'm having some problems passing url parameters with an open.window command. I'm not terribly familiar with java script but here is the code below. When executed it opens the...
3
by: ram | last post by:
how do I open a word document within a webform? I need to open the document within the form so the user can edit the document and then click on a button on the form (so that the document is...
6
by: mistral | last post by:
what is correct way open a PDF document in new window use hyperlink? I want show images thumbnails linked with PDF files, when click on thumbnail, PDF will be opened in new window. Some of PDF...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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,...

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.