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:
type –
String
representing annotation type.
- 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 |
No |
Please use Page.createLink(). |
FreeText |
Yes |
|
Square |
Yes |
|
Circle |
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 |
Yes |
|
Movie |
Yes |
|
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:
annot –
PDFAnnotation
.
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:
blackBoxes –
Boolean
Whether to use black boxes at each redaction or not.imageMethod –
Integer
.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)¶
Render the page into a
Pixmap
using the givencolorspace
andalpha
while applying thetransform
. 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.colorspace –
ColorSpace
.alpha –
Boolean
.renderExtra –
Boolean
Whether annotations and widgets should be rendered.usage –
String
“View” or “Print”.
- Returns:
Pixmap
.
EXAMPLE
var pixmap = pdfPage.toPixmap(mupdf.Matrix.identity, mupdf.ColorSpace.DeviceRGB, false, true, "View");