Where did PdfWriter() come from? Cheers! Mark
-- Try before you cry: http://www.mail-archive.com/struts-user%40jakarta.apache.org/ -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 14, 2002 5:26 AM file.When i try to open the PDF file I get the error as "There was an error opening this document.Could not repair this file" public class PDF extends Action { public ActionForward perform(ActionMapping mapping, ActionForm form,HttpServletRequest request,HttpServletResponse response) throws IOException, ServletException { try { Document document = new Document(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PdfWriter.getInstance(document, baos); document.open(); document.add(new Paragraph("Hello World")); document.close(); response.setContentType("application/pdf"); response.setContentLength(baos.size()); ServletOutputStream out = response.getOutputStream(); baos.writeTo(out); out.flush(); } catch (Exception e2) { System.out.println("Error in "+getClass().getName()+"\n"+e2); } return null; } } -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>