PDFPage

Extends Page.

Instance methods

getAnnotations()

Return array of all annotations on the page.

Returns:

[...].

EXAMPLE

var annots = pdfPage.getAnnotations();
createAnnotation(type)

Create a new blank annotation of a given type.

Arguments:
Returns:

PDFAnnotation.

EXAMPLE

var annot = pdfPage.createAnnotation("Text");

Annotation types

Note

Annotation types are also referred to as “subtypes”.

Name

Supported

Notes

Text

Yes

Link

Yes

Please use Page.createLink().

FreeText

Yes

Square

Yes

Circle

Yes

Line

Yes

Polygon

Yes

PolyLine

Yes

Highlight

Yes

Underline

Yes

Squiggly

Yes

StrikeOut

Yes

Redact

Yes

Stamp

Yes

Caret

Yes

Ink

Yes

Popup

No

FileAttachment

Yes

Sound

No

Movie

No

RichMedia

No

Widget

No

Screen

No

PrinterMark

No

TrapNet

No

Watermark

No

3D

No

Projection

No

deleteAnnotation(annot)

Delete the annotation from the page.

Arguments:
  • annotPDFAnnotation.

EXAMPLE

pdfPage.deleteAnnotation(annot);
getWidgets()

Return array of all widgets on the page.

Returns:

[...].

EXAMPLE

var widgets = pdfPage.getWidgets();
update()

Loop through all annotations of the page and update them. Returns true if re-rendering is needed because at least one annotation was changed (due to either events or JavaScript actions or annotation editing).

EXAMPLE

pdfPage.update();
applyRedactions(blackBoxes, imageMethod)

Applies redactions to the page.

Arguments:
  • blackBoxesBoolean Whether to use black boxes at each redaction or not.

  • imageMethodInteger. 0 for no redactions, 1 to redact entire images, 2 for redacting just the covered pixels.

Note

Redactions are secure as they remove the affected content completely.

EXAMPLE

pdfPage.applyRedactions(true, 1);
process(processor)

Run through the page contents stream and call methods on the supplied PDF processor.

Arguments:
  • processor – User defined function.

EXAMPLE

pdfPage.process(processor);
toPixmap(transform, colorspace, alpha, renderExtra, usage, box)

Render the page into a Pixmap using the given colorspace and alpha while applying the transform. Rendering of annotations/widgets can be disabled. A page can be rendered for e.g. “View” or “Print” usage.

Arguments:
  • transform[a,b,c,d,e,f] The transform matrix.

  • colorspaceColorSpace.

  • alphaBoolean.

  • renderExtraBoolean Whether annotations and widgets should be rendered.

  • usageString “View” or “Print”.

  • boxString Default is “CropBox”.

Returns:

Pixmap.

EXAMPLE

var pixmap = pdfPage.toPixmap(mupdf.Matrix.identity,
                              mupdf.ColorSpace.DeviceRGB,
                              false,
                              true,
                              "View",
                              "CropBox");
createSignature(name)

Create a new signature widget with the given name as field label.

Arguments:
  • nameString The desired field label.

Returns:

PDFWidget.

EXAMPLE

var signatureWidget = pdfPage.createSignature("test");
countAssociatedFiles()

Return the number of Associated Files on this page. Note that this is the number of files associated to this page, not necessarily the total number of files associated with elements throughout the entire document.

Returns:

Integer

EXAMPLE

var count = pdfPage.countAssociatedFiles();
associatedFile(n)

Return the Filespec object that represents the nth Associated File on this page. 0 <= n < count, where count is the value given by countAssociatedFiles().

Return fileSpecObject:

Object File Specification Object.

EXAMPLE

var obj = pdfPage.associatedFile(0);