the http reponse to file? ASP.NET 2.0

Discussion in 'ASP .Net' started by =?Utf-8?B?RnJlZHJpaw==?=, May 2, 2006.

  1. 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
    =?Utf-8?B?RnJlZHJpaw==?=, May 2, 2006
    #1
    1. Advertising

  2. =?Utf-8?B?RnJlZHJpaw==?=

    Joerg Jooss Guest

    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
    Joerg Jooss, May 3, 2006
    #2
    1. Advertising

  3. 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
    >
    >
    >
    >
    =?Utf-8?B?RnJlZHJpaw==?=, May 4, 2006
    #3
  4. =?Utf-8?B?RnJlZHJpaw==?=

    Joerg Jooss Guest

    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
    Joerg Jooss, May 9, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?bWc=?=
    Replies:
    1
    Views:
    406
    Peter Blum
    Apr 5, 2004
  2. Simon Prince
    Replies:
    1
    Views:
    560
    Bobby Ryzhy
    Jul 14, 2004
  3. bruce barker

    Re: client reponse ports for asp.net

    bruce barker, Jul 20, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    456
    =?Utf-8?B?U2lsdmlhIEJydW5ldCBKb25lcw==?=
    Jul 20, 2004
  4. RayAll

    Reponse.Redirect ()

    RayAll, Apr 18, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    2,941
    Gabriel Lozano-MorĂ¡n
    Apr 18, 2005
  5. =?Utf-8?B?SklNLkgu?=

    Q: Reponse.Redirect

    =?Utf-8?B?SklNLkgu?=, Jun 23, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    620
    Kevin Spencer
    Jun 23, 2005
Loading...

Share This Page