Skip to content

Instantly share code, notes, and snippets.

@thomasjungblut
Created November 28, 2013 09:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomasjungblut/7689460 to your computer and use it in GitHub Desktop.
Save thomasjungblut/7689460 to your computer and use it in GitHub Desktop.
String pathBase = "/home/thomasjungblut/Downloads/";
PDDocument source = PDDocument.load(pathBase
+ "c1.pdf");
PDDocument lastPage = PDDocument.load(pathBase + "updated.pdf");
source.removePage(source.getNumberOfPages() - 1);
source.addPage( (PDPage) lastPage.getDocumentCatalog().getAllPages().get(0) );
source.save(pathBase + "c2_updated.pdf");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment