Guest User

Untitled

a guest
Dec 10th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. public static void main(String[] args) throws Exception {
  2. PDDocument pdf = null;
  3. try {
  4. System.out.println("argument:" + args[0]);
  5. pdf = PDDocument.load(new File(args[0]));
  6. addOverlay(pdf); //flattens overlay, fields lost.
  7. pdf.save("output.pdf");
  8. pdf.close();
  9. } finally {
  10. if (pdf != null) {
  11. pdf.close();
  12. }
  13. }
  14. return;
  15. }
  16.  
  17. private static void mergeOverlay(final PDDocument pdf) throws IOException {
  18. PDDocument overlayPDF = PDDocument.load(new File("overlay.pdf"));
  19. Overlay overlay = new Overlay();
  20. overlay.overlay(overlayPDF, pdf);
  21. }
Add Comment
Please, Sign In to add comment