java read and write file pdf code example
Example: open a pdf file and write to it in java
// Create a PdfDocument instance
PdfDocument doc = new PdfDocument();
try {
// Write some text on page 1
doc.writeText("Hello, World!"); // automatically creates a blank page
// Save document to file
doc.save("sample_doc1.pdf");
doc.close();
} catch (IOException | PdfException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}