hi,
i wrote thi simple script to make a pdf downloaded from the browser.
When i test it on netscape 7.1 on linux it opens the dialog box correctly. If i use internet explore in displays the pdf in acrobat reader.
Any idea to solve this problem
Thanks in advance.



<[EMAIL PROTECTED] import="java.io.*,com.lowagie.text.*,com.lowagie.text.pdf.*"errorPage="error.jsp"%>
<%
//
// Template JSP file for iText
// by Tal Liron
//
String nome,cognome;
nome = request.getParameter( "nome" );
cognome = request.getParameter( "cognome" );
//response.setContentType( "application/pdf" );
//response.setContentType("APPLICATION/OCTET-STREAM");
response.setContentType("APPLICATION/download");
response.setHeader("Content-Disposition","filename=modulo.pdf");
// step 1: creation of a document-object
Document document = new Document();
// step 2:
// we create a writer that listens to the document
// and directs a PDF-stream to a temporary buffer
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
PdfWriter.getInstance( document, buffer );
// step 3: we open the document
document.open();
// step 4: we add a paragraph to the document
document.add(new Paragraph(cognome+" "+nome));
// step 5: we close the document
document.close();
// step 6: we output the writer as bytes to the response output
DataOutput output = new DataOutputStream( response.getOutputStream() );
byte[] bytes = buffer.toByteArray();
response.setContentLength(bytes.length);
for( int i = 0; i < bytes.length; i++ ) { output.writeByte( bytes[i] ); }
%>


--
Dott. Giuliano Intrito
Universita' degli Studi di Napoli "Parthenope"
Via Amm. F. Acton, 38 - 80133 Napoli
Tel: 0814977112
E-mail: [EMAIL PROTECTED]



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to