This should be easy but I'm having a hard time with it. I'm currently doing
the following:

// START OF DOCUMENT
response.setContentType("application/pdf");
Document document = new Document();

try{

ByteArrayOutputStream buffer = new ByteArrayOutputStream();
PdfWriter writer = PdfWriter.getInstance(document, buffer);
document.open(); 

PdfFormField field = PdfFormField.createSignature(writer);
field.setWidget(new Rectangle(218, 577, 285, 589),
PdfAnnotation.HIGHLIGHT_INVERT);
field.setFieldName("mySig");
field.setFlags(PdfAnnotation.FLAGS_PRINT);
writer.addAnnotation(field);

// END OF DOCUMENT
document.close();

DataOutput dataOutput = new DataOutputStream(response.getOutputStream());
byte[] bytes = buffer.toByteArray();
response.setContentLength(bytes.length);
for(int i = 0; i < bytes.length; i++) {
        dataOutput.writeByte(bytes[i]);
  }

}catch(DocumentException e){
e.printStackTrace();
}


but I need to open an existing PDF at this location below and do the above.

String rootPath = System.getProperty("catalina.home");
rootPath = rootPath + File.separator + "webapps" + File.separator + "ROOT" +
File.separator;
rootPath = rootPath + "test/reportjsps/MyForm.pdf";

how would I modify the above so that it opens this existing PDF?


thanks

-- 
View this message in context: 
http://itext-general.2136553.n4.nabble.com/Open-an-existing-PDF-instead-of-creating-blank-tp2231939p2231939.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------

_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.itextpdf.com/book/
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/

Reply via email to