ComPDFKit Web SDK
    Preparing search index...

    Class DisplayMode

    A page layout mode together with the coordinate conversions between page and window coordinates. Page coordinates are unrotated, top-left origin, in PDF points; window coordinates are CSS pixels relative to the viewer element.

    Index
    • Creates a display mode.

      Parameters

      • docViewer: DisplayModeViewer

        The viewer to lay out.

      • mode: DisplayModes

        The layout mode.

      • OptionalisScrollable: boolean

        Whether the layout scrolls. Defaults to true for every mode except Custom.

      Returns DisplayMode

    • Lays out and returns the page numbers laid out

      Returns number[]

    • Returns the offset of a page.

      Parameters

      • _pageNumber: number

        Page number (1-based); unused.

      Returns WindowPoint

      Always (0, 0).

    • Display size of the page (full rotation, zoom not applied)

      Parameters

      • pageNumber: number

      Returns { height: number; width: number; x: number; y: number }

      • height: number

        Displayed height in PDF points.

      • width: number

        Displayed width in PDF points.

      • x: number

        Always 0.

      • y: number

        Always 0.

    • Returns the CSS scale applied to the viewer element.

      Returns { scaleX: number; scaleY: number }

      Always 1 on both axes.

      • scaleX: number

        Horizontal scale.

      • scaleY: number

        Vertical scale.

    • The page each of the two window points falls on; null when on no page

      Parameters

      • pt1: WindowPoint
      • pt2: WindowPoint

      Returns { first: number | null; last: number | null }

      • first: number | null

        The lower of the two page numbers; null when the point is on no page.

      • last: number | null

        The higher of the two page numbers; null when the point is on no page.

    • Pages intersecting the viewport (extended by topMargin viewport heights up and down, and horizontalMargin viewport widths left and right), sorted by visible fraction in the unextended viewport, highest first. Extends by half a viewport each way by default, for prefetching.

      Parameters

      • OptionaltopMargin: number
      • OptionalhorizontalMargin: number

      Returns number[]

    • Checks whether the mode scrolls through all pages.

      Returns boolean

      true for Continuous, FacingContinuous and Cover.

    • Checks whether the layout scrolls.

      Returns boolean

      The value given to the constructor, or true for every mode except Custom.

    • Converts a point from page coordinates to window coordinates, applying zoom and the full page rotation.

      Parameters

      • pt: WindowPoint

        Point in page coordinates.

      • pageNumber: number

        Page number (1-based).

      Returns WindowPoint

      The point in window coordinates.

    • Ignores the page's own /Rotate: page coordinates are in display orientation (sizes of getPageInfo), with only the view rotation added

      Parameters

      • pt: WindowPoint
      • pageNumber: number

      Returns WindowPoint

    • Overrides layout and coordinate methods with your own implementations; methods not given keep the default behavior.

      Parameters

      • functions: DisplayModeCustomFunctions

        The methods to override.

      Returns void

    • Deprecated custom grid: columns columns, only rows [startRow, endRow) laid out; switches to Custom mode

      Parameters

      • columns: number
      • _totalRows: number
      • _currentRow: number
      • startRow: number
      • endRow: number

      Returns void

    • Converts a point from window coordinates to page coordinates of a page.

      Parameters

      • pt: WindowPoint

        Point in window coordinates.

      • pageNumber: number

        Page number (1-based).

      Returns WindowPoint & { pageNumber: number }

      The point in page coordinates, with the page number.

      • pageNumber: number

        The page number passed in.

    • Like windowToPage, but ignores the page's own rotation: the result is in display orientation, with only the view rotation removed.

      Parameters

      • pt: WindowPoint

        Point in window coordinates.

      • pageNumber: number

        Page number (1-based).

      Returns WindowPoint & { pageNumber: number }

      The point in display-oriented page coordinates, with the page number.

      • pageNumber: number

        The page number passed in.

    docViewer: DisplayModeViewer

    The viewer to lay out.