Sebau-nu-mu
0
Q:

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();
}   
0

New to Communities?

Join the community