title: Split a single page inside a PDF into three parts
body: <p>Split a single page inside a PDF into three parts, using PDRectangle, which is just hidden, the content is still there.<br />
  How to delete the content too? What you see is what you get</p>
  <pre><code>  public static void avgSplitEveryPage(String path, String curPath) {
      try (PDDocument document = new PDDocument();
           PDDocument doc = PDDocument.load(new File(path))) {
          Splitter splitter = new Splitter();
  
          PDPageTree pages = doc.getDocumentCatalog().getPages();
          for (int i = 0; i &lt; pages.getCount(); i++) {
  
              PDPage topPage = pages.get(i);
              PDRectangle topRectangle = topPage.getCropBox();
              float upperRightY1 = topRectangle.getUpperRightY();
              topRectangle.setLowerLeftY((upperRightY1 / 3) * 2);
              document.importPage(topPage);
  
              PDPage midPage = pages.get(i);
              PDRectangle midRectangle = midPage.getCropBox();
              float upperRightY11 = midRectangle.getUpperRightY();
              midRectangle.setUpperRightY(upperRightY11 / 3);
              midRectangle.setLowerLeftY((upperRightY11 / 3) * 2);
              document.importPage(midPage);
  
              PDPage bottomHalfPage = pages.get(i);
              PDRectangle bottomHalfRectangle = bottomHalfPage.getCropBox();
              bottomHalfRectangle.setUpperRightY(upperRightY11 / 3);
              bottomHalfPage.setCropBox(bottomHalfRectangle);
              document.importPage(bottomHalfPage);
          }
          
          document.save(curPath);
      } catch (Exception e) {
          e.printStackTrace();
      }
  }
  </code></pre>