API Documentation for Page
NoPoDoFo Page
class Page {
rotation: number
trimBox: Rect
number: number
width: number
height: number
contents: Object
resources: Object
getField<T extends Field>(index: number): T
getFields(): Field[]
fieldCount(): number
getFieldIndex(fieldName: string): number
getMediaBox(): Rect
getBleedBox(): Rect
getArtBox(): Rect
annotationCount(): number
createAnnotation(type: NPDFAnnotation, rect: Rect): Annotation
createField(type: NPDFFieldType, annot: Annotation, form: Form, opts?: Object): Field
deleteField(index: number): void
flattenFields(): void
getAnnotation(index: number): Annotation
deleteAnnotation(index: number): void
}
Constructors
NoPoDoFo does not support a public Page constructor. To create a new Page use Document.createPage
Properties
rotation
Page rotation accessor; Get and set the page rotation value. This value must be between 0 and 270, and in increments of 90.
trimBox
TrimBox accessor; Get and set the page's trimbox Rect. The trimbox is enclosed by the bleedbox, and the trimbox encloses the artbox.
number
Get the page number, 1-based.
width
The page width, a standard page is 612 X 792 (width X height)
height
The page height, a standard page is 612 X 792 (width X height)
contents
Get the page's contents Object. To append to this contents object, if the object is a Dictionary
resources
Get the page's resources Object
Methods
getField
getField<T extends Field>(index: number): T
Get the Field from the page's Annotation Array
getFields
getFields(): Field[]
Get all the Fields in the page's Annotation Array
fieldCount
fieldCount(): number
Get the number of Fields on the page
getFieldIndex
getFieldIndex(fieldName: string): number
Get the index of a Field matching the fieldName provided
getMediaBox
getMediaBox(): Rect
Get the media box of the page
getBleedBox
getBleedBox(): Rect
Get the bleed box of the page
getArtBox
getArtBox(): Rect
Get the art box of the page
annotationCount
annotationCount(): number
Get the number of annotations on the page. This is all annotation types, to get only the count of annotations of type Widget
use fieldCount
createAnnotation
createAnnotation(type: NPDFAnnotation, rect: Rect): Annotation
Create a new Annotation. This annotation will be added to this page's annotations Array
createField
createField(type: NPDFFieldType, annot: Annotation, form: Form, opts?: Object): Field
Create a new Field. This field will be added to this page's annotations Array and the AcroForm automatically
deleteField
deleteField(index: number): void
Delete the field at the provided index
flattenField
flattenFields(): void
Flattening is the process of taking a fields appearance stream, appending that appearance stream to the page, and then removing the field object and annotation widget, and scrubbing all references to the field from the document (scrub the page and acroform dictionary)
getAnnotation
getAnnotation(index: number): Annotation
Get the Annotation at the provided index
deleteAnnotation
deleteAnnotation(index: number): void
Delete an Annotation at the provided index