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

the http reponse to file? ASP.NET 2.0

I want to generate a pdf file of "the current page".

It is a ASP.NET aspx file created partly from GET parameters, but most often
using the ASP.NET event model (i.e. clicking buttons etc).

One of the buttons is called "Generate a pdf document of the current page"
and it clicking it should create a pdf document on the server side and
returning the pdf to the user.

To my aid I have a server side component that can convert a file or the html
content of a URL to a pdf document. So if I somehow can generate the
information of the current aspx page to file, I can convert it to pdf and
change the Response.ContentType to "application/pdf".

But the question is how to generate the file that I want to convert. If I
send the current URL to the pdf component, it will point to the page and how
it looks when no interaction has been done. What I really want is the page
after all clicks, i.e. how it looks "right now".

Any ideas? Thank you,

--
/Fredrik
May 2 '06 #1
3 1208
Thus wrote Fredrik,
I want to generate a pdf file of "the current page".

It is a ASP.NET aspx file created partly from GET parameters, but most
often using the ASP.NET event model (i.e. clicking buttons etc).

One of the buttons is called "Generate a pdf document of the current
page" and it clicking it should create a pdf document on the server
side and returning the pdf to the user.

To my aid I have a server side component that can convert a file or
the html content of a URL to a pdf document. So if I somehow can
generate the information of the current aspx page to file, I can
convert it to pdf and change the Response.ContentType to
"application/pdf".

But the question is how to generate the file that I want to convert.
If I send the current URL to the pdf component, it will point to the
page and how it looks when no interaction has been done. What I really
want is the page after all clicks, i.e. how it looks "right now".

Any ideas? Thank you,


HttpResponse allows you set another stream as a filter using HttpResponse.Filter.
You could use that to write the response to a temporary file, create the
PDF, and write the PDF back to the actual response stream.

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
May 3 '06 #2
Very interesting!

It seems the file isn't created until the Response ends. This seems natural
to me when thinking about it.

But when the response has ended, I per definition have lost my chance to
alter the response (remeber, I wamt to send the pdf instead). I guess I will
have to trigger another request somehow, and in the new Response show the pdf.

Havn't still figured out the last details yet. Thanks, anyhow, for your kind
help.

Regards

--
/Fredrik
"Joerg Jooss" wrote:
Thus wrote Fredrik,
I want to generate a pdf file of "the current page".

It is a ASP.NET aspx file created partly from GET parameters, but most
often using the ASP.NET event model (i.e. clicking buttons etc).

One of the buttons is called "Generate a pdf document of the current
page" and it clicking it should create a pdf document on the server
side and returning the pdf to the user.

To my aid I have a server side component that can convert a file or
the html content of a URL to a pdf document. So if I somehow can
generate the information of the current aspx page to file, I can
convert it to pdf and change the Response.ContentType to
"application/pdf".

But the question is how to generate the file that I want to convert.
If I send the current URL to the pdf component, it will point to the
page and how it looks when no interaction has been done. What I really
want is the page after all clicks, i.e. how it looks "right now".

Any ideas? Thank you,


HttpResponse allows you set another stream as a filter using HttpResponse.Filter.
You could use that to write the response to a temporary file, create the
PDF, and write the PDF back to the actual response stream.

Cheers,
--
Joerg Jooss
ne********@joergjooss.de

May 4 '06 #3
Thus wrote Fredrik,
Very interesting!

It seems the file isn't created until the Response ends. This seems
natural to me when thinking about it.


Are you sure you just don't need a Response.Flush()?

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
May 10 '06 #4

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

Similar topics

3
by: superseed | last post by:
Hi, I'm currently coding in C# a class to control a PTZ (Pan Tilt Zoom) Camera. To control the camera I have to send request on a CGI on it. Something like this : ...
4
by: Richard | last post by:
Hello, I'm dynamically writing out a web page using response.write. The page has images and hyperlinks (each hyperlink points back to the same page, but with a different parameter which...
1
by: JIM.H. | last post by:
Hello, In my login screen I validate user against SQL table and call my main page with Reponse.Redirect("myPage.aspx"); I see my application comes there but does not switch to myPage.aspx, I used...
1
by: Nuno Magalhaes | last post by:
I'm doing a "low level" project that consists on monitoring certain QoS parameters such as: Time to resolve dns, time to connect, time to receive data, time to receive all web page, time to close...
1
by: Samuel Shulman | last post by:
Hi I am looking for a way to send a POST request using the Reponse.Redirect or any thing similar Thank you, Samuel
8
by: anukedari | last post by:
Hi, Could any boby please help to get the answers for the following questions: Is Apache always sends "X-Cache:MISS" header even when caching is off (disable)? or Can we say that cache...
0
by: djtodd | last post by:
Is there any way to use reponse.redirect and provide network credentials for basic auth along with it to prevent the nt security dialog box when hitting the new server location? or, is there another...
2
by: ross-mcm | last post by:
I have an app that gets a file from a web server. An ASP page is passed authenitication data (username, password) and a filename. The file is read and then output by the ASP page so the only...
1
by: jmk | last post by:
I'm trying to use an external SMS-service through .NET Framework 1.1 and using the webClient.DownloadData(strMessage) method. The strMessage is a string consisting the parameters to send a message,...
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?
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
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...

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.