473,385 Members | 2,180 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.

Outputing a .pdf stream to current window

I'm using the following lines to output a Crystal Report object to a
webForm:

Dim s As System.IO.MemoryStream =
cr.ExportToStream(CrystalDecisions.Shared].ExportFormatType.PortableDocFormat)

With Response

.Buffer = True

.ClearContent()

.ClearHeaders()

.ContentType = "application/pdf"

.BinaryWrite(s.ToArray)

.End()

End With

The report is opened in a new window; however, if I replace
..BinaryWrite(s.ToArray) by let's say .Write("hello"), I get it to output
in the same window.

How could I force the report (pdf format) to open in the same window?

Thanks for your help.

Dan Kimhi


Nov 19 '05 #1
2 1938
Hello Dan,

You'll need to add the Content-Disposition header.

Response.AddHeader("Content-Disposition", "inline;filename=report.pdf")

--
Matt Berther
http://www.mattberther.com
I'm using the following lines to output a Crystal Report object to a
webForm:

Dim s As System.IO.MemoryStream =
cr.ExportToStream(CrystalDecisions.Shared].ExportFormatType.PortableDo
cFormat)

With Response

.Buffer = True

.ClearContent()

.ClearHeaders()

.ContentType = "application/pdf"

.BinaryWrite(s.ToArray)

.End()

End With

The report is opened in a new window; however, if I replace
.BinaryWrite(s.ToArray) by let's say .Write("hello"), I get it to
output in the same window.

How could I force the report (pdf format) to open in the same window?

Thanks for your help.

Dan Kimhi


Nov 19 '05 #2
Hi Matt,

Thanks. But, I'm still getting the same after adding "Content-Disposition".
Am I doing anything wrong? Why does it work with the .Write(string) ?

Dan Kimhi

"Matt Berther" <mb******@hotmail.com> a écrit dans le message de news:
82***********************@news.microsoft.com...
Hello Dan,

You'll need to add the Content-Disposition header.

Response.AddHeader("Content-Disposition", "inline;filename=report.pdf")

--
Matt Berther
http://www.mattberther.com
I'm using the following lines to output a Crystal Report object to a
webForm:

Dim s As System.IO.MemoryStream =
cr.ExportToStream(CrystalDecisions.Shared].ExportFormatType.PortableDo
cFormat)

With Response

.Buffer = True

.ClearContent()

.ClearHeaders()

.ContentType = "application/pdf"

.BinaryWrite(s.ToArray)

.End()

End With

The report is opened in a new window; however, if I replace
.BinaryWrite(s.ToArray) by let's say .Write("hello"), I get it to
output in the same window.

How could I force the report (pdf format) to open in the same window?

Thanks for your help.

Dan Kimhi


Nov 19 '05 #3

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

Similar topics

3
by: daniel aviad galron | last post by:
Greetings. I need to output a hexadecimal number using cout. I've done this as shown below: cout << hex << stuff; But it outputs the letters in lowercase. Is it possible to output a,b,c,d,e, and...
1
by: James Willock | last post by:
Hi, I have a class derived from ApplicationException as below (excuse formatting): public class MyException : ApplicationException { public string CompanyName { get {return...
3
by: MJB | last post by:
I'm getting an IStream back from function xmlHttp.responsestream. I would like to convert this to a System.IO.Stream in order to work with it in my application. Has anyone encountered this and...
4
by: TT (Tom Tempelaere) | last post by:
Hey there, I need a string stream, but I can't find one in .NET. I thought StringWriter would derive from Stream, alas it doesn't do so. Which leads me to my next question: What is the purpose...
8
by: Mantorok | last post by:
Hi all I have the contents of a text file that I would like to output to the response stream, however IE thinks it is XML and comes up with and error, here is the code: Response.ContentType =...
1
by: Suedois | last post by:
Hi, I use a Crystal Report Viewer to export a report in PDF. This is done by a code behind procedure like this: private void ExportReport() { MemoryStream oStream = new MemoryStream() ;...
1
by: beatTheDevil | last post by:
Hello all, I have a question that concerns how C++ input streams (istream, ifstream, istringstream, etc.) behave using the extraction (>>) operator when at the end of a stream's contents. For...
8
by: Jon Slaughter | last post by:
can one "stream" image data to a browser? I created an image using gd and when I do imagepng I just get the binary data for the image written as text instead of the image itself. Now I'm...
0
by: jardin | last post by:
Dear all, I'm new in C# and web development. In current web page I have just a link to text file on server, not web server. I have to create code to read from that text file, save file text to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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...
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
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?
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...

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.