@SuppressWarnings("unused") private void save(PDFDocument doc) { try { doc.saveAndClose(new FileOutputStream("test.pdf")); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }