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

Stream to PDF problem

Hi,

I have a PDF document saved as Binary Stream in my Database and I'm excuting
this line of code to open the PDF document:
Response.BinaryWrite(myfile); // myfile is the stream converted to byte[] type

and It's working fine, but the only problem that Acrobat Reader 8 is not
opening it directly but always asking me if I want to save it or Cancel. So,
I always have to save disk before opening it!!!? so what could be the issue
with Acrobat Reader 8.
Thanks

Dec 18 '06 #1
3 1204
Hi,

Badis wrote:
Hi,

I have a PDF document saved as Binary Stream in my Database and I'm excuting
this line of code to open the PDF document:
Response.BinaryWrite(myfile); // myfile is the stream converted to byte[] type

and It's working fine, but the only problem that Acrobat Reader 8 is not
opening it directly but always asking me if I want to save it or Cancel. So,
I always have to save disk before opening it!!!? so what could be the issue
with Acrobat Reader 8.
The one asking you if you want to save or open is not Acrobat, it's the
web browser. The question is triggered by the user's configuration for
the give MIME type returned by the web server. In your case, the MIME
type is (or should be) "application/pdf". When the browser receives
this, it will check how it has been configured for this MIME type. If
not setting is found, or depending on what the user entered, he will
present the open/save dialog to the user.

So bottom line is: You cannot force the user to open the document
automatically if he doesn't want. You cannot control how each web
browser is going to react.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Dec 18 '06 #2
zee
Try this out

Response.AddHeader("Content-Disposition", "inline;filename=File.pdf");
Response.ContentType = "application/pdf";
Response.BinaryWrite(myfile);
Response.Flush();
Response.Close();

tc

Dec 18 '06 #3
Hi ,

thanks Zee you code has solve the problem but the only thing is that that
pdf document is now opening in main page and I would like it to be opened in
a new page

Cheers

"zee" wrote:
Try this out

Response.AddHeader("Content-Disposition", "inline;filename=File.pdf");
Response.ContentType = "application/pdf";
Response.BinaryWrite(myfile);
Response.Flush();
Response.Close();

tc

Jan 8 '07 #4

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

Similar topics

6
by: Yechezkal Gutfreund | last post by:
I have been using the following code (successfully) to read Xml formated text packets from a TCP stream. The output from the server stream consists of a sequence of well formed Xml documents...
0
by: mario.lat_ | last post by:
Hallo to all, I have write a little script for connecting to cisco router BUT I have a problem: I have to send to router all the commands and then I have to read the output. If I send a command1...
3
by: Sir Psycho | last post by:
Hi, For some reason, when i step over this code, it returns the full byte stream im expecting from the server, however when I let it run with no intervention, it only seems to grab a small chunk...
8
by: T Driver | last post by:
Anyone have any idea how I can do the following? I have a connection to an XML file on a site I do not control, getting a string representation of the xml data that I can then feed to my...
2
by: =?Utf-8?B?VHJlY2l1cw==?= | last post by:
I've made a post last Friday in regards to this subject, but I'm still a little lost. I've a problem regarding reading a stream. I am connected to a port that sends information using a stream. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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
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...
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...

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.