-2

I am a 2nd year university student . in my java course I submit my project PDF spilt and merge . in this project I want to make that if I give page numbers of the PDF then only these pages make another smaller PDF . thus I save memory . but I didn't know PDF is so much complicated . today I am fully afraid knowing about PDF . is it able to do it with java code ?. please help me . and how much thing in PDF Ican do with java . please help me...... thank in advance

Alimur Razi Rana
  • 87
  • 1
  • 2
  • 9
  • 2
    Possible duplicate of [How to split a pdf using aapache pdfbox](http://stackoverflow.com/questions/32259167/how-to-split-a-pdf-using-apache-pdfbox) – Nerzid Apr 23 '16 at 09:24
  • Welcome to stackoverflow... be aware that it isn't a forum or a chatroom, and not about opinions or emotions. The site is best to get answers how to do something with code. And yes, your question is a duplicate, see link above, but the answer below is good too. Yes PDF is very complex. That's why there are libraries like PDFBox :-) – Tilman Hausherr Apr 23 '16 at 10:27

1 Answers1

1

Try this:

PDDocument document = PDDocument.load("full path here ...\\pdfFile.pdf");
Splitter splitter = new Splitter();
List<PDDocument> splittedDocuments = splitter.split(document);

To control the number of pages on every splitted PDF use : setSplitAtPage(split)

Necessary Libraries : Apache PDFBox and Apache Commons Logging

Take a look at setSplitAtPage

Jad Chahine
  • 6,849
  • 8
  • 37
  • 59