Buongiorno a tutti volevo sapere come fare per scrivere su un pdf già esistente.
Mi spiego meglio mi serve di creare un metodo che vada a compilare i campi di un pdf (il modulo 730). Io per ora ho tirato fuori questo:
codice:
Document document = new Document();
try {
// step 2:
// we create a writer that listens to the document
// and directs a PDF-stream to a file
PdfWriter.getInstance(document,new FileOutputStream("730.pdf"));
// step 3: we open the document
document.open();
// step 4: we add a paragraph to the document
document.add(new Paragraph("Hello World2"));
} catch (DocumentException de) {
System.err.println(de.getMessage());
} catch (IOException ioe) {
System.err.println(ioe.getMessage());
}
// step 5: we close the document
document.close();
ma il problema è che mi scrive un pdf nuovo, completamente vuoto.