Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

iText in Struts

 
Vani Bandargal
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using iText in Struts to produce pdf. I know want my pdf to be editable.
Does anybody know how to do it.
Note: I only need to edit the text. I am only displaying some palin text(the purpose is for letter generation)
I also don't need to retrive back the editable information.
All I need is to make the content(text) editable

Please advice me what I am missing

Code:
public ActionForward doGenerateLeterPDF(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse response) throws WebException {
try{
Document document = new Document();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PdfWriter writer = 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);
}catch(Exception e)
{
logger.error("Exception: " + e);
throw new WebException(e);
}

return null;

}

[ February 02, 2007: Message edited by: Vani D Bandargal ]

[ February 02, 2007: Message edited by: Vani D Bandargal ]
[ February 02, 2007: Message edited by: Vani D Bandargal ]
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please don't post the same question to multiple forums: CarefullyChooseOneForum

Let's continue the discussion in this duplicate thread, where you have an answer already.
[ February 02, 2007: Message edited by: Ulf Dittmer ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic