Friday, 22 January 2021

OpenSource Merge/Split Tool ApachePDF Box (Including setting up Java and configure PATH variable to allow java to be used)

 1, Download Apache PDFBox command line tools :

https://pdfbox.apache.org/download.html


2. Download Java for Windos 

https://java.com/en/download/


3. Configure path variable in windows, so java will be recognized in command line or command prompt.

(Restart command prompt to ensure java command line to be used after setting up path)

  1. Right click on My Computer
  2. Select Properties
  3. Select Advanced System Settings
  4. Select Advanced tab
  5. Select Environment Variables
  6. Select Path under System Variables
  7. Click on Edit button
  8. Click new button
  9. Add Your Java installed path, for example : U:\CodeRepo\JavaOracle\bin
  10. restart commmand line prompt
https://stackoverflow.com/questions/15796855/java-is-not-recognized-as-an-internal-or-external-command

4.  Open powershell, cd your installed apachePDFBOx directory :  cd U:\CodeRepo\pdfBox
5. For merge use : 
merge :

java -jar pdfbox-app-2.y.z.jar PDFMerger <Source PDF files (2 ..n)> <Target PDF file>



java -jar pdfbox-app-2.0.22.jar PDFMerger pay-20-01-02.pdf pay-20-01-16.pdf pay-merged.pdf

Split use :

java -jar pdfbox-app-2.y.z.jar PDFSplit [OPTIONS] <PDF file>

// Split page 1 to page 20 to 1 file
 java -jar pdfbox-app-2.0.22.jar PDFSplit -startPage 1 -endPage 20  <your_dest.pdf>

https://pdfbox.apache.org/2.0/commandline.html


Video Guide: 
https://www.youtube.com/watch?v=tIWY9QTlKKU



No comments:

Post a Comment