# Class: PageViewport

## PageViewport

#### new PageViewport()

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

Source:
  - shared/util.js, line 888

### 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:
  - shared/util.js, line 970

##### 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:
  - shared/util.js, line 1012
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:
  - shared/util.js, line 987
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:
  - shared/util.js, line 997
See:
  - convertToViewportPoint

##### Returns:

Contains corresponding coordinates of the rectangle in the viewport coordinate space.

Type
  Array