# Class: PageViewport

## PDFJS. PageViewport

#### new PageViewport()

  PDF page viewport created based on scale, rotation and offset.
  Source:
    - shared/util.js, line 792

### Methods

#### clone(args) → {PDFJS.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 874

  ##### Returns:

  Cloned viewport.
  Type
    PDFJS.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 916
  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 891
  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 901
  See:
    - convertToViewportPoint

  ##### Returns:

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