Class: PageViewport

PageViewport

new PageViewport()

PDF page viewport created based on scale, rotation and offset.
Source:

Methods

clone(args) → {PageViewport}

Clones viewport with additional properties.
Parameters:
Name Type Description
args Object (optional) If specified, may contain the 'scale' or 'rotation' properties to override the corresponding properties in the cloned viewport.
Source:
Returns:
Cloned viewport.
Type
PageViewport

convertToPdfPoint(x, y) → {Object}

Converts viewport coordinates to the PDF location. For examples, useful for converting canvas pixel location into PDF one.
Parameters:
Name Type Description
x number X coordinate.
y number Y coordinate.
Source:
See:
  • convertToViewportPoint
Returns:
Object that contains 'x' and 'y' properties of the point in the PDF coordinate space.
Type
Object

convertToViewportPoint(x, y) → {Object}

Converts PDF point to the viewport coordinates. For examples, useful for converting PDF location into canvas pixel coordinates.
Parameters:
Name Type Description
x number X coordinate.
y number Y coordinate.
Source:
See:
  • convertToPdfPoint
  • convertToViewportRectangle
Returns:
Object that contains 'x' and 'y' properties of the point in the viewport coordinate space.
Type
Object

convertToViewportRectangle(rect) → {Array}

Converts PDF rectangle to the viewport coordinates.
Parameters:
Name Type Description
rect Array xMin, yMin, xMax and yMax coordinates.
Source:
See:
  • convertToViewportPoint
Returns:
Contains corresponding coordinates of the rectangle in the viewport coordinate space.
Type
Array