Loading ...
Sorry, an error occurred while loading the content.

Streaming generated Pdf using FOPServlet- Saving Problem

Expand Messages
  • vijay_singh
    Hi I don t know if somebody has come across this issue. We are using FOP Servlet and we dynamically generated PDF on fly and stream it to the browser. As we
    Message 1 of 4 , Sep 15, 2005
    • 0 Attachment
      Hi

      I don't know if somebody has come across this issue. We are using FOP
      Servlet and we dynamically generated PDF on fly and stream it to the
      browser. As we are not creating a output file, the generated pdf file
      takes the name of the URL in the browser window. Is there anyway to
      give a name to the file, so that when users save the generated file
      they see the proper name of the file and not the URL in the browser.

      I suppose we can save the file and then stream to browser, but we don't
      want to do it because then we have to take care of the different
      request different versions of that file.

      Vijay
    • Jirka Kosek
      ... Try adding these HTTP headers in your HTTP response: Content-type: application/pdf (or application/octet-stream with some browsers) Content-disposition:
      Message 2 of 4 , Sep 16, 2005
      • 0 Attachment
        vijay_singh wrote:

        > I don't know if somebody has come across this issue. We are using FOP
        > Servlet and we dynamically generated PDF on fly and stream it to the
        > browser. As we are not creating a output file, the generated pdf file
        > takes the name of the URL in the browser window. Is there anyway to
        > give a name to the file, so that when users save the generated file
        > they see the proper name of the file and not the URL in the browser.

        Try adding these HTTP headers in your HTTP response:

        Content-type: application/pdf (or application/octet-stream with some
        browsers)
        Content-disposition: filename=foo.pdf

        --
        ------------------------------------------------------------------
        Jirka Kosek e-mail: jirka@... http://www.kosek.cz
        ------------------------------------------------------------------
        Profesion�ln� �kolen� a poradenstv� v oblasti technologi� XML.
        Pod�vejte se na n�� nov� spu�t�n� web http://DocBook.cz
        Podrobn� p�ehled �kolen� http://xmlguru.cz/skoleni/
        ------------------------------------------------------------------
        Nejbli��� term�ny �kolen�: DocBook 5.-7.12. * XSL-FO 19.-20.12.
        XSLT 17.-20.10. * XML sch�mata (v�etn� RELAX NG) 7.-9.11.
        ------------------------------------------------------------------



        [Non-text portions of this message have been removed]
      • vijay_singh
        ... FOP ... the ... file ... to ... file ... browser. ... stream with some ... Thanks. This solution does give you save option or open open option. But is
        Message 3 of 4 , Sep 16, 2005
        • 0 Attachment
          --- In XSL-FO@yahoogroups.com, Jirka Kosek <jirka@k...> wrote:
          > vijay_singh wrote:
          >
          > > I don't know if somebody has come across this issue. We are using
          FOP
          > > Servlet and we dynamically generated PDF on fly and stream it to
          the
          > > browser. As we are not creating a output file, the generated pdf
          file
          > > takes the name of the URL in the browser window. Is there anyway
          to
          > > give a name to the file, so that when users save the generated
          file
          > > they see the proper name of the file and not the URL in the
          browser.
          >
          > Try adding these HTTP headers in your HTTP response:
          >
          > Content-type: application/pdf (or application/octet-
          stream with some
          > browsers)
          > Content-disposition: filename=foo.pdf
          >
          > --
          > ------------------------------------------------------------------
          > Jirka Kosek e-mail: jirka@k... http://www.kosek.cz
          > ------------------------------------------------------------------
          > Profesionální ¹kolení a poradenství v oblasti technologií XML.
          > Podívejte se na ná¹ novì spu¹tìný web http://DocBook.cz
          > Podrobný pøehled ¹kolení http://xmlguru.cz/skoleni/
          > ------------------------------------------------------------------
          > Nejbli¾¹í termíny ¹kolení: DocBook 5.-7.12. * XSL-FO 19.-20.12.
          > XSLT 17.-20.10. * XML schémata (vèetnì RELAX NG) 7.-9.11.
          > ------------------------------------------------------------------
          >
          >
          >
          > [Non-text portions of this message have been removed]
          Thanks.
          This solution does give you save option or open open option. But is
          there any way file can be shown in the new window and if the user
          saves after having a look, it should have a proper file name?
        • J.Pietschmann
          ... This is a FAQ. IIRC the answer is to set Content-Disposition: inline; filename= your-filename.pdf as HTTP header. Google for Content-Disposition for
          Message 4 of 4 , Sep 16, 2005
          • 0 Attachment
            vijay_singh wrote:
            > I don't know if somebody has come across this issue. We are using FOP
            > Servlet and we dynamically generated PDF on fly and stream it to the
            > browser. As we are not creating a output file, the generated pdf file
            > takes the name of the URL in the browser window. Is there anyway to
            > give a name to the file, so that when users save the generated file
            > they see the proper name of the file and not the URL in the browser.


            This is a FAQ. IIRC the answer is to set
            Content-Disposition: inline; filename="your-filename.pdf"
            as HTTP header. Google for "Content-Disposition" for further
            information.

            J.Pietschmann
          Your message has been successfully submitted and would be delivered to recipients shortly.