Thank you to every one that reposnse that thread. I has able to makes it
work.
The problem is something that i call " bout.writeTo(out); " before i
configure the response, and i have to call after i set all headers.
Ps: Dont ask me why !!! 8-)
Angelo Galvao
On Tue, Mar 11, 2008 at 2:28 PM, Edward W. Rouse <[EMAIL PROTECTED]>
wrote:
> Exactly, which is why it is an exercise in futility to even worry about
> it ;) Just leave it as a pdf and let the user decide what to do with it
> since you really can't control what they do anyway.
>
>
>
> Edward W. Rouse
>
> -----Original Message-----
> *From:* [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> *Sent:* Tuesday, March 11, 2008 12:10 PM
> *To:* Post all your questions about iText here; Edward W. Rouse
> *Cc:* 'Post all your questions about iText here'
> *Subject:* Re: [iText-questions] Download HTML to PDF file. Show the"Save
> as"dialog
>
> Sorry about the double mail, but the "they could always just associate the
> application/xpto type to the reader and you'd be back to no 'Save As' dialog"
> will always happen in a web environment here the user controls a large part
> of the ui.
>
> So you really shouldn't worry about it (because you can't control it).
>
> Rui
>
> Citando "Edward W. Rouse" <[EMAIL PROTECTED]>:
>
> That would work but the user would have to know to rename the extension to
> .pdf when they save it. And once they understand how you tricked the browser
> they could always just associate the application/xpto type to the reader and
> you'd be back to no 'Save As' dialog.
>
> Edward W. Rouse
>
> -----Original Message-----
> *From:* [EMAIL PROTECTED] [mailto:
> [EMAIL PROTECTED] *On Behalf Of *
> [EMAIL PROTECTED]
> *Sent:* Tuesday, March 11, 2008 11:52 AM
> *To:* Post all your questions about iText here
> *Subject:* Re: [iText-questions] Download HTML to PDF file. Show the "Save
> as"dialog
>
> Hi,
>
>
>
> According to http://www.onjava.com/pub/a/onjava/excerpt/jebp_3/index3.htmlyou
> have to give an unrecognizable content type in order for the browser to
> prompt for save instead of searching for the appropriated reader (if
> installed).
>
> I tested and it does work.
>
> ByteArrayOutputStream baos = new ByteArrayOutputStream();
>
> .
>
> .
>
> .
>
> //send file
> response.setHeader("Expires", "0");
> response.setHeader("Cache-Control", "must-revalidate,
> post-check=0, pre-check=0");
> response.setHeader("Pragma", "public");
> response.setContentType("application/xpto");
> response.setContentLength(baos.size());
> ServletOutputStream out = response.getOutputStream();
> baos.writeTo(out);
> out.flush();
>
>
> Citando Angelo Luis <[EMAIL PROTECTED]>:
>
> Using Java EE ... :(
>
> On Tue, Mar 11, 2008 at 1:31 PM, Sérgio Oliveira <[EMAIL PROTECTED]>
> wrote:
>
> > Hello,
> >
> > Are you using .net? If so, see the Response.TransmitFile method.
> >
> > ------------------------------
> > Date: Tue, 11 Mar 2008 09:35:19 -0300
> > From: [EMAIL PROTECTED]
> > To: iText-questions@lists.sourceforge.net
> > Subject: [iText-questions] Download HTML to PDF file. Show the "Save as"
> > dialog
> >
> >
> > Hello,
> >
> > My application has a option that transforms a HTML page to a PDF and
> > donwloads the PDF from the web server. "Simple". For this I use the
> > combination of iText, JTidy and Flying Saucer. The problems arrives when
> > download the PDF from a Struts Action. I want to show the Save As dialog,
> > but always the browser open the reader, always. :(
> >
> > Look my code when a configure the response:
> >
> > response.setContentType( "application/octet-stream" ); // I try to use
> > application/pdf to
> >
> > response.setHeader("Expires", "0");
> > response.setHeader("Cache-Control", "must-revalidate, post-check=0,
> > pre-check=0");
> > response.setHeader("Pragma", "public");
> > response.setHeader("Content-disposition", "attachment;filename="+
> > fileName );
> > response.setContentLength( bout.size() );
> >
> > out.flush();
> >
> >
> >
> > PS: Sorry for my english.
> >
> >
> > Angelo Galvão
> >
> >
> > ------------------------------
> > Express yourself instantly with MSN Messenger! MSN
> > Messenger<http://clk.atdmt.com/AVE/go/onm00200471ave/direct/01/>
> >
> > -------------------------------------------------------------------------
> >
> > This SF.net email is sponsored by: Microsoft
> > Defy all challenges. Microsoft(R) Visual Studio 2008.
> > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> > _______________________________________________
> > iText-questions mailing list
> > iText-questions@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/itext-questions
> > Buy the iText book: http://itext.ugent.be/itext-in-action/
> >
> >
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> Buy the iText book: http://itext.ugent.be/itext-in-action/
>
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/