Class CPDFPage

java.lang.Object
com.compdfkit.core.page.CPDFPage

public class CPDFPage extends Object
TPDFPage defines methods used to render PDF pages and work with annotations, text, selections and so on.
  • Field Details

    • lockObj

      public static final Object lockObj
  • Method Details

    • getPageNum

      public int getPageNum()
    • setPageNum

      public void setPageNum(int pageNum)
    • getBounds

      public RectF getBounds()
      not in use currently
    • getSize

      public RectF getSize()
      Gets page size, the width iscandroid.graphics.RectF#width(), the height isandroid.graphics.RectF#height()
      Returns:
      Returns page size.
    • getRotation

      public int getRotation()
      Gets the rotation angle for the page in degrees.
      Returns:
      Returns the rotation angle for the page in degrees.
    • setRotation

      public boolean setRotation(int rotation)
      Sets the rotation angle for the page in degrees.
      Parameters:
      rotation - Rotation on a page. Must be 0, 90, 180 or 270.
      Returns:
      Whether to successfully set the rotation angle for the page in degrees.
    • flatten

      public boolean flatten(CPDFPage.PDFFlattenOption flattenOption)
      Flatten annotations and form fields into the page contents.
      Parameters:
      flattenOption - One of the flattenOption values denoting the page usage, more CPDFPage.PDFFlattenOption
      Returns:
      Returns whether to successfully flatten.
    • getAnnotCount

      public int getAnnotCount()
      Gets the count of annotations on the page.
      Returns:
      Returns the count of annotations on the page.
    • getAnnotations

      public List<CPDFAnnotation> getAnnotations()
      Gets all the annotation collections on the page.
      Returns:
      Returns all the annotation collections on the page.
    • updateFormAp

      public boolean updateFormAp()
      Update AP of all forms on the page.
      Returns:
      Whether to successfully Update AP.
    • deleteAnnotation

      public boolean deleteAnnotation(CPDFAnnotation annotation)
      Removes the specified annotation from the page.
      Parameters:
      annotation - The specified annotation to be removed
      Returns:
      Returns whether to successfully remove the specified annotation from the page.
    • addAnnot

      public CPDFAnnotation addAnnot(CPDFAnnotation.Type type, CPDFDocument document)
      Adds annotations on page according to the type of annotation, more: CPDFAnnotation.Type
      Parameters:
      type - The type of annotation to be added, more: CPDFAnnotation.Type
      document - This class is about CPDFDocument, one CPDFDocument class for one document.
      Returns:
      Returns the added annotations object.
    • applyRedactions

      public boolean applyRedactions()
      Applies redaction annotations in current page.
      Returns:
      Returns whether to successfully apply redaction in current page.
    • extractImages

      public boolean extractImages(String filePath)
      Exports all the images on the page.
      Parameters:
      filePath - Exports image to specified path.
      Returns:
      Returns whether to successfully export all the images.
    • addFormWidget

      public CPDFWidget addFormWidget(CPDFWidget.WidgetType type, CPDFDocument document)
      Adds a form widget on the page according to the type of form widgets. , more: CPDFAnnotation.Type
      Parameters:
      type - Type of form widgets, more: CPDFAnnotation.Type
      document - This class is about CPDFDocument, one CPDFDocument class for one document.
      Returns:
      Returns the added form widgets object.
    • getPagePtr

      public long getPagePtr()
      Get the page pointer in the native layer.
      Returns:
      page pointer
    • isValid

      public boolean isValid()
      Whether object is valid.
      Returns:
      Returns whether object is valid.
    • releaseAllAnnotations

      public void releaseAllAnnotations()
      Releases all annotation resources on the page.
    • removeUntaggedWatermark

      public boolean removeUntaggedWatermark()
      Remove untagged watermark.
      Returns:
      Returns whether to successfully remove untagged watermark.
    • close

      public void close()
      When the object is no longer in use, call this method to release resources.