Skip to content
ComPDF
Guides

Page Editor

The page editor allows users to manage PDF pages, including inserting, replacing, extracting, copying, rotating, and deleting pages. Available editing menu items can be configured via GlobalConfig.

Configure Available Menu Items

Control the operation menus displayed in the page editor via global.pageEditor.menus:

json
{
  "global": {
    "pageEditor": {
      "menus": [
        "insertPage",
        "replacePage",
        "extractPage",
        "copyPage",
        "rotatePage",
        "deletePage"
      ]
    }
  }
}
ValueDescription
insertPageInsert page
replacePageReplace page
extractPageExtract page
copyPageCopy page
rotatePageRotate page
deletePageDelete page

To show only insert and delete:

json
{
  "global": {
    "pageEditor": {
      "menus": [
        "insertPage",
        "deletePage"
      ]
    }
  }
}

CPDFPageEditDialogFragment

CPDFPageEditDialogFragment is the main Fragment for page editing, located in the com.compdfkit.tools.docseditor.pdfpageeditor package.

There are two ways to open the page editor:

  1. Via More menu: Include "documentEditor" in toolbarConfig.availableMenus
  2. Open programmatically:
java
CPDFPageEditDialogFragment pageEditFragment = CPDFPageEditDialogFragment.newInstance();
pageEditFragment.show(getSupportFragmentManager(), "pageEdit");
kotlin
val pageEditFragment = CPDFPageEditDialogFragment.newInstance()
pageEditFragment.show(supportFragmentManager, "pageEdit")
ComponentDescription
CPDFPageEditDialogFragmentPage edit dialog
CPDFPageEditFragmentPage edit content Fragment
CPDFPageEditAdapterPage thumbnail grid adapter
CPDFDocumentPageActionHelperPage operation logic helper

Insert Page

CPDFPageInsertDialogFragment provides the insert page dialog, supporting:

  • Insert a blank page
  • Insert from another PDF file
  • Specify insert position (before first page / after last page / before/after specified page)
  • Select page size

Replace Page

After selecting a page, you can replace it with pages from another PDF document.

Extract Page

Selected pages (one or more) can be extracted as a standalone PDF file.

Page Reordering

Supports drag-and-drop thumbnail reordering of pages.