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
calculateDocumentViewPageCoordinates()
calculateDocumentViewPageCoordinates(
point
,width
,height
,rotation
):WebSdkViewPoint
Converts a point from PDF coordinates to PDF Web SDK document view page canvas coordinates. This conversion is useful when you need to translate coordinates from PDF space to PDF Web SDK document view space, taking into account the dimensions of the page and its rotation.
Parameters
• point: ViewingSdkPdfPoint
The ViewingSdkPdfPoint
object representing PDF coordinates to be converted to PDF Web SDK document view page canvas coordinates.
• width: number
The width of the document view page canvas.
• height: number
The height of the document view page canvas.
• rotation: Rotation
Returns
WebSdkViewPoint
A new instance of WebSdkViewPoint
representing the converted coordinates in document view page canvas space.
calculateViewingSdkPdfCoordinates()
calculateViewingSdkPdfCoordinates(
point
,width
,height
,rotation
):ViewingSdkPdfPoint
Converts a point from PDF Web SDK document view page canvas coordinates to PDF coordinates. This conversion is useful when you need to translate coordinates from PDF Web SDK document view space to PDF space, taking into account the dimensions of the page and its rotation.
Parameters
• point: WebSdkViewPoint
The WebSdkViewPoint
object representing PDF coordinates to be converted to PDF Web SDK document view page canvas coordinates.
• width: number
The width of the document view page canvas.
• height: number
The height of the document view page canvas.
• rotation: Rotation
Returns
ViewingSdkPdfPoint
A new instance of ViewingSdkPdfPoint
representing the converted coordinates in document view page canvas space.
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
calculateRotatedPoint()
static
calculateRotatedPoint(point
,rotation
,pageWidth
,pageHeight
):WebSdkViewPoint
Calculates rotated point around center page center.
Parameters
• point: ViewingSdkPdfPoint
The Point
object representing PDF point to be rotated around page center.
• rotation: Rotation
The rotation value to apply to a point.
• pageWidth: number
• pageHeight: number
Returns
WebSdkViewPoint
A new instance of Point
representing the rotated point around page center.
calculateRotatedWebSdkViewPoint()
static
calculateRotatedWebSdkViewPoint(point
,rotation
,pageWidth
,pageHeight
):ViewingSdkPdfPoint
Calculates rotated point around center page center.
Parameters
• point: WebSdkViewPoint
The Point
object representing WebSdkViewPoint to be rotated around page center.
• rotation: Rotation
The rotation value to apply to a point.
• pageWidth: number
• pageHeight: number
Returns
ViewingSdkPdfPoint
A new instance of Point
representing the rotated point around page center.