473,395 Members | 1,622 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,395 software developers and data experts.

Open stream as pdf

Hi, I'm using this code to open a pdf BinaryStream from database as pdf
Document and it's working :
Response.AddHeader("Content-Disposition", "attachment;filename=File.pdf");
Response.ContentType = "application/pdf";
Response.BinaryWrite(myfile);
Response.Flush();
Response.Close();

The only thing that the browser is poping up a message to "Open", "Save" or
"Cancel" document before openning it.
So, I change the top linr of code with:
Response.AddHeader("Content-Disposition", "inline;filename=File.pdf");
and the problem is that the document is opened in the same main page.

So, how can I force the generated PDF Document to Just open up directly in a
new page, when running the code!!?
Thanks
Jan 15 '07 #1
1 1934
You need to change the link to your page from

<a href="PDFWriter.aspx">

to

<a href="PDFWriter.aspx" target="_blank">

"Badis" <Ba***@discussions.microsoft.comwrote in message
news:EE**********************************@microsof t.com...
Hi, I'm using this code to open a pdf BinaryStream from database as pdf
Document and it's working :
Response.AddHeader("Content-Disposition", "attachment;filename=File.pdf");
Response.ContentType = "application/pdf";
Response.BinaryWrite(myfile);
Response.Flush();
Response.Close();

The only thing that the browser is poping up a message to "Open", "Save"
or
"Cancel" document before openning it.
So, I change the top linr of code with:
Response.AddHeader("Content-Disposition", "inline;filename=File.pdf");
and the problem is that the document is opened in the same main page.

So, how can I force the generated PDF Document to Just open up directly in
a
new page, when running the code!!?
Thanks

Jan 15 '07 #2

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

Similar topics

0
by: Marco Nicosia | last post by:
Hello gang, My coworker and I are writing a Python class for the other developers within our team. This class is supposed to encapsulate several things, including daemonizing, setting up...
4
by: Klaus Füller | last post by:
I would like to use the unix,et.al-fstat() system-call on some sort of stream which is already open and connected to a disk file. An example: I have an open stream and want to know the numerical...
9
by: Charles F McDevitt | last post by:
I'm trying to upgrade some old code that used old iostreams. At one place in the code, I have a path/filename in a wchar_t string (unicode utf-16). I need to open an ifstream to that file. ...
4
by: Simon Cheng | last post by:
Hi, How do I open a Word or Excel document inside an event handler (e.g., Page_Load())? Thanks, Simon
6
by: Shimon Sim | last post by:
Hi 1) Is it possible to force browser to open image in default windows application? That is what specifies in Folder Options for jpg extension. 2) Also if the 1) is possible is it possible to...
10
by: Gunnar G | last post by:
I'm having problem reading from the beginning of a file. Here is the code (more or less) ifstream codefin; ofstream codefout; while (not_annoyed)
0
by: Madhavi | last post by:
Hi I am working on a proted project from VB to C# in VB stream.open without any parameters works but in C# i need to pass certain arguments like Stream.Open(null,...
5
by: Ryan Liu | last post by:
Hi, Both way works, I'd just ask some experts which way is better? My application creates a log file daily. Now each time when I write a log, I will open the file and append to the end....
16
by: Gary Wessle | last post by:
Hi please help with this. std::fstream iofs( f.c_str(), std::ios::in|std::ios::out ); std::cout << f << '\n' << iofs.is_open() << std::endl; puts out...
6
by: Andy2500 | last post by:
Hi, I'd like to upload an image to a folder, then I have 3 diffrents examples but all of them give an error "failed to open stream: Permission denied", althrough the C:\Inetpub\wwwroot is not...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.