Here is my Servlet code which I cannot get to work as far as adding a new
form field:
protected void doGet(HttpServletRequest arg0, HttpServletResponse arg1)
throws ServletException, IOException {
HttpSession session = arg0.getSession(true);
arg1.setContentType("application/pdf");
System.out.println("Here");
//URL url = new URL(arg0.getParameter("url"));
URL url = new URL(arg0.getParameter("p1"));
String url2 = arg0.getParameter("p2");
String url3 = arg0.getParameter("p3");
System.out.println(url);
PdfReader reader = new PdfReader(url);
//PdfReader reader = new PdfReader(templatePath +
"somePDF.pdf ");
try {
//PdfStamper stamper = new
PdfStamper(reader,arg1.getOutputStream());
PdfStamper stamp = new PdfStamper(reader, new
FileOutputStream("c:\\PDFTest.pdf"));
PdfWriter writer = stamp.getWriter();
AcroFields form = stamp.getAcroFields();
form.setField("Status0","Steven Lynn Dyke1");
form.removeField("Status1");
TextField tf = new TextField(writer, new
Rectangle(67, 785, 340, 800), "Who");
tf.setText("Vee Dyke");
tf.setFontSize(24);
tf.setVisibility(BaseField.VISIBLE);
writer.addAnnotation(tf.getTextField());
stamp.setFormFlattening(true);
stamp.close();
//StringBuffer javascript = new StringBuffer();
//javascript.append("JSSilentPrint(this)");
//PdfAction pdfAction=
PdfAction.javaScript(javascript.toString(), writer);
//writer.addJavaScript(pdfAction);
//stamper.close();
System.out.println("Finished");
} catch (DocumentException de) {
de.printStackTrace();
System.err.println("document: " +
de.getMessage());
}
} ------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions:
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/