Hello!
I have create a servlet which creates a document in pdf. It function with
Netscape but not with the msy in spite of the code which should be ok. And
I do not believe that it is because of plug-in.
PS: I translated the text with a tools
thank you
public void init(ServletConfig config) throws ServletException {
super.init(config);
}
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, java.io.IOException {
java.io.PrintWriter out = new java.io.PrintWriter(resp.getOutputStream());
try {
if ((strLang)!=null) {
PDFTaxPrint(resp);
}
}
catch (Exception ex) {
ex.printStackTrace(out);
}
}
public void PDFTaxPrint (HttpServletResponse out) {
Document document = new Document(PageSize.A4, 30, 34, 10, 5);
ByteArrayOutputStream pdftax = new ByteArrayOutputStream();
try
{
PdfWriter.getInstance(document, pdftax);
document.open();
.....pdftax
.....pdftax
document.add(datatable);
}
// we close the document
document.close();
out.setContentType("application/pdf");
out.setContentLength(pdftax.size());
or
// This 19 factor was found by Trial-N-Error which works for all my
cases.
out.setContentLength(pdftax.size()+19);
ServletOutputStream pdfout = out.getOutputStream();
pdftax.writeTo(pdfout);
pdfout.flush();
pdfout.close();
}
catch (Exception de) {
System.err.println(de.getMessage());
}
}
Krattinger Fran�ois
Epinette 112
1797 M�nchenwiler
Email: [EMAIL PROTECTED]
http://www.krattinger.ch Version allemande
http://www.krattinger.ch/index_fr.html version fran�ais
________________________________________
E-Mail for everyone! http://www.bluemail.ch/ powered by Bluewin!
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions