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

PDF rendering

Hi there!

We are rendering some PDF reports from an ASP.NET application, directly
to the IE browser. Those reports are beign generated from a SQL
Reporting Services server. We have the requirement of displaying the
reports inside the browser. In order to do that, we have this:

Response.ClearContent();
Response.ClearHeaders();
Response.AppendHeader("content-length", reportData.Length.ToString());
Response.AppendHeader("content-disposition", "inline;
filename=SalesReport.pdf");
Response.ContentType = "application/pdf";
Response.BinaryWrite(reportData);
Response.Flush();
Response.Close();

The report shows perfectly. But our problem is that inside the Acrobat
Reader "sub window" on the browser, if the user clicks "Send By Email",
the reader creates an outlook email with an attachment called
"Report.ASPX". This one is the ASPX page used for rendering the report,
instead the "SalesReport.pdf" name suggested in the headers. Of course,
the customers complains about seeing garbage when looking at the attach
(really a PDF file, with the wrong extension).

Is there are any other way to indicate the filename to IE? Any ideas or
workaround on this?

Any suggestion is really appreciated. Thanks a ton in advance!!!

Dec 30 '05 #1
6 1752
I think you need something like this, specificying an attachment rather than
just a filename

Response.AddHeader("Content-Disposition", "attachment; filename=fred.pdf")

--
Regards

John Timney
Microsoft MVP

"Nautilus" <ma************@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
Hi there!

We are rendering some PDF reports from an ASP.NET application, directly
to the IE browser. Those reports are beign generated from a SQL
Reporting Services server. We have the requirement of displaying the
reports inside the browser. In order to do that, we have this:

Response.ClearContent();
Response.ClearHeaders();
Response.AppendHeader("content-length", reportData.Length.ToString());
Response.AppendHeader("content-disposition", "inline;
filename=SalesReport.pdf");
Response.ContentType = "application/pdf";
Response.BinaryWrite(reportData);
Response.Flush();
Response.Close();

The report shows perfectly. But our problem is that inside the Acrobat
Reader "sub window" on the browser, if the user clicks "Send By Email",
the reader creates an outlook email with an attachment called
"Report.ASPX". This one is the ASPX page used for rendering the report,
instead the "SalesReport.pdf" name suggested in the headers. Of course,
the customers complains about seeing garbage when looking at the attach
(really a PDF file, with the wrong extension).

Is there are any other way to indicate the filename to IE? Any ideas or
workaround on this?

Any suggestion is really appreciated. Thanks a ton in advance!!!

Dec 30 '05 #2
Hi John! Many thanks for the input!

Unfortunately, that produces that IE treat that as an attachment,
displaying the "Save As / Open" dialog... and we need to display the
PDF right inside the browser window.

That's why we tried with the "inline" option... :(

Thanks again!

Best!
Mariano

Dec 30 '05 #3
You could try adding a 'name' parameter to your Content-Type:

Response.ContentType = "application/pdf; name=SalesReport.pdf";

Dec 30 '05 #4
Hi there!

Many thanks for the input again! I just tried that, and now IE just
doesn't display anything... :(

It's very frustrating that IE doesn't well interpret the
"content-disposition" headers, and pass that to Acrobat.. as it should
be. I keep trying any kind of workarounds, like using a
"Report.pdf.aspx" page, but it's the same.

Thanks a ton to all!
Mariano

Dec 30 '05 #5
Why not write the report to disk with a correct filename and then point the
browser at the file. If you need to insure a unique name, you could create a
directory with a based name and then write the pdf inside of that
directory.

--

Andrew Robinson
www.binaryocean.com
www.bellinghamdotnet.org
"Nautilus" <ma************@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
Hi there!

We are rendering some PDF reports from an ASP.NET application, directly
to the IE browser. Those reports are beign generated from a SQL
Reporting Services server. We have the requirement of displaying the
reports inside the browser. In order to do that, we have this:

Response.ClearContent();
Response.ClearHeaders();
Response.AppendHeader("content-length", reportData.Length.ToString());
Response.AppendHeader("content-disposition", "inline;
filename=SalesReport.pdf");
Response.ContentType = "application/pdf";
Response.BinaryWrite(reportData);
Response.Flush();
Response.Close();

The report shows perfectly. But our problem is that inside the Acrobat
Reader "sub window" on the browser, if the user clicks "Send By Email",
the reader creates an outlook email with an attachment called
"Report.ASPX". This one is the ASPX page used for rendering the report,
instead the "SalesReport.pdf" name suggested in the headers. Of course,
the customers complains about seeing garbage when looking at the attach
(really a PDF file, with the wrong extension).

Is there are any other way to indicate the filename to IE? Any ideas or
workaround on this?

Any suggestion is really appreciated. Thanks a ton in advance!!!

Dec 31 '05 #6
Hi Andrew!

Yes, that would be our last chance... But we are trying to avoid it
because of "performance" problems. In order to have the same
"SalesActivities.pdf" name for each report request, we would need to
create a folder (for example based on a GUID), and put the file
there... and of course, add some background process for erasing the
files, and removing the folders.. :)

At this point, I'm thinking in pushing to change the requirement, and
leave this as is.

Many thanks to all!

Jan 2 '06 #7

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

Similar topics

1
by: eeyimaya | last post by:
Hello, I read from sun site about fullscreen mode and active rendering and now I am in doubt! is active rendering for only fullscreen applications? I am planning to develop an windowed application...
6
by: David Opstad | last post by:
I have a question about text rendering I'm hoping someone here can answer. Is there a way of doing linguistically correct rendering of Unicode strings in Python? In simple cases like Latin or...
3
by: Beetlegeuse | last post by:
Here is a screenshot of three different versions of rendering of the trouble area: http://img371.imageshack.us/img371/2572/layout8xg.gif (ignore the language of the text) The first...
3
by: David Whitney | last post by:
All: I have a control that renders a table. As the table is rendered, each row in the table is constructed by creating a run-time (dynamic) object that is derived from an HtmlTableRow. The row...
5
by: Dave A | last post by:
I am writing an ASP.NET tool that will allow the client to create their own online froms. ie the client can add tect boxes, text, drop downs,etc with absolutely no technical skill what so ever....
4
by: tobfon | last post by:
I'm creating a scientific visualization application with rather high demands on performance. I've created a nice rendering engine for it in C++/OpenGL and a python interface to the rendering...
3
by: ramesh | last post by:
Hi all, I am facing a problem with the rendering of html into a windows application (C# .NET). I am trying with two possible approaches: 1. Use a control that directly renders the html into...
0
by: Juan R. | last post by:
Since the idea of encoding mathematics using MathML is being very far from popular due to a number of factors -expensive tools, bad accesibility of generated code, unusual verbosity, lack of...
5
by: paul.hester | last post by:
Hi all, I have a custom control with an overridden Render method. Inside this method I'm rendering each control in its collection using their RenderControl method. However, I'm running into a...
12
by: Boris Borcic | last post by:
Hello, I am trying to use UI Automation to drive an MS Windows app (with pywinauto). I need to scrape the app's window contents and use some form of OCR to get at the texts (pywinauto can't...
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:
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: 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
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
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...

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.