Class: Page
A single page in a Pdf document.
Extends
Accessors
document
get
document():Document
the pdf document to which the page belongs
Returns
hasChanges
get
hasChanges():boolean
indicates if the page or its content has been changed since the document was last saved
Returns
boolean
height
get
height():number
Height of the page in PDF coordinates. This represents the height of the page, taking into account the rotation.
Returns
number
isDeleted
get
isDeleted():boolean
indicates whether the page was deleted
Returns
boolean
originalHeight
get
originalHeight():number
Original height of the page in PDF coordinates. This represents the original height of the page without considering any rotation.
Returns
number
originalWidth
get
originalWidth():number
Original width of the page in PDF coordinates. This represents the original width of the page without considering any rotation.
Returns
number
pageNumber
get
pageNumber():number
page number
Returns
number
rotation
get
rotation():Rotation
Rotation of the page
Returns
width
get
width():number
Width of the page in PDF coordinates. This represents the width of the page, taking into account the rotation.
Returns
number
Methods
addEventListener()
addEventListener<
K
>(type
,listener
):void
Register a function that will be called whenever the specified event is delivered.
Type Parameters
• K extends "textFragmentsLoaded"
A generic type representing the key of the event type.
Parameters
• type: K
String representing the event type to listen for.
• listener
The function that will be executed when an event of the specified type occurs.
Returns
void
Inherited from
dispatchEvent()
dispatchEvent<
K
>(type
,args
):void
Dispatches an event to all registered listeners.
Type Parameters
• K extends "textFragmentsLoaded"
A generic type representing the key of the event type.
Parameters
• type: K
String representing the event type to dispatch.
• args: Parameters
<PageEventMap
[K
]>
The data associated with the event.
Returns
void
Inherited from
getTextFragments()
getTextFragments():
TextFragment
[]
Gets text fragments of a Pdf.Page
.
Returns
A Promise that resolves to an Array containing the text fragments.
Throws
Pdf.NotLoadedError
if text fragments are not loaded yet.
loadTextFragments()
loadTextFragments():
Promise
<TextFragment
[]>
Loads text fragments of a Pdf.Page
.
Returns
Promise
<TextFragment
[]>
A Promise that resolves to an Array containing the text fragments.
removeAllListeners()
removeAllListeners<
K
>(type
):void
Remove all listeners for a given event.
Type Parameters
• K extends "textFragmentsLoaded"
A generic type representing the key of the event type.
Parameters
• type: K
String representing the event for which to remove all listeners.
Returns
void
Inherited from
EventEmitter
.removeAllListeners
removeEventListener()
removeEventListener<
K
>(type
,listener
):void
Removes an event listener previously registered with addEventListener.
Type Parameters
• K extends "textFragmentsLoaded"
A generic type representing the key of the event type.
Parameters
• type: K
String representing the event for which to remove an event listener.
• listener
The event listener function of the event handler to remove from the event target.
Returns
void
Inherited from
EventEmitter
.removeEventListener
render()
render(
renderOptions
):Promise
<Blob
>
Render the given page
Parameters
• renderOptions: PageRenderOptions
Returns
Promise
<Blob
>
Blob containing the image data
rotate()
rotate(
direction
,degree
):void
Rotates the page in the specified direction by the specified degree
The rotation can only be done in steps of 90 degrees or a multiple thereof
Parameters
• direction: RotationDirection
clockwise or counter-clockwise
• degree: number
= 90
rotation in degrees in multiples of 90
Returns
void
transformDocumentViewPointQuadrilateralToPdfPointQuadrilateral()
transformDocumentViewPointQuadrilateralToPdfPointQuadrilateral(
quadrilateral
,width
,height
,rotation
):Quadrilateral
<PdfPoint
>
Converts a quadrilateral from document view coordinates to PDF coordinates.
This function transforms a Quadrilateral<DocumentViewPoint>
, which corresponds to a quadrilateral scaled proportionally based on the rendered size of the page on screen,
to a Quadrilateral<PdfPoint>
, which is measured in PDF units. The conversion takes into account the dimensions of the document view page canvas and the rotation of the page.