+ Start a Discussion
kisore pockisore poc 

split pdf

i have lines of code in java which splits the pdf attachement ,. how to use this in salesforce,. 
below is the set of java code.
import org.apache.pdfbox.multipdf.Splitter; 
import org.apache.pdfbox.pdmodel.PDDocument;

import java.io.File; 
import java.io.IOException; 
import java.util.List; 
import java.util.Iterator;
  
public class SplitPages {
   public static void main(String[] args) throws IOException {

      //Loading an existing PDF document
      File file = new File("C:/PdfBox_Examples/sample.pdf");
      PDDocument document = PDDocument.load(file); 

      //Instantiating Splitter class
      Splitter splitter = new Splitter();

      //splitting the pages of a PDF document
      List<PDDocument> Pages = splitter.split(document);

      //Creating an iterator 
      Iterator<PDDocument> iterator = Pages.listIterator();

      //Saving each page as an individual document
      int i = 1;
      while(iterator.hasNext()) {
         PDDocument pd = iterator.next();
         pd.save("C:/PdfBox_Examples/sample"+ i++ +".pdf");
      }
      System.out.println("Multiple PDF’s created");
      document.close();
   }
}
sophian smithssophian smiths
There are several solutions available to PDF Split Tool single PDF into multiple files. But, a few days I was also searching for a utility to PDF Split Program then, I came to a free solution i.e. Softaken PDF Split & Merge. It is the simple and reliable tool to divide PDF into multiple parts. Moreover, this application provides 4 options to split PDF visit at:- https://www.softwarewiki.org/split-pdf/