rmapi-js
    Preparing search index...

    Class Page

    a .rm page on its own, read from its bytes or made blank

    It reads as every page does, through PageView: its layers, strokes, highlights and typed text, and what changed since a version. editAs edits it as any install, two copies of one page merge, and toBytes writes it back byte for byte. The client hands pages out held, as ClientPage, and the library opens them as OpenPage.

    const page = Page.parse(bytes);
    const editor = page.editAs("0f3c8a52-6e1d-4b8e-9a4f-2d7c1b5e8f90");
    editor
    .drawingLayer()
    .addStroke({ pen: Pen.Fineliner, color: Color.Black, points });
    for (const layer of page.layers()) {
    console.log(layer.name, layer.strokes().length);
    }
    const written = page.toBytes();

    Hierarchy (View Summary)

    Index
    • get contentBounds(): StrokeBounds | undefined

      the smallest rectangle holding everything on the page, or undefined for an empty page; a maxY past the screen height is the height for PageSize.scrolled

      Returns StrokeBounds | undefined

    • get formatVersion(): 3 | 5 | 6

      the .rm format version the page is written in: 3, 5 or 6

      Returns 3 | 5 | 6

    • get legacyVersion(): 5 | 3 | undefined

      3 or 5 for a page of that older version, which can only be read

      Returns 5 | 3 | undefined

    • get paperSize(): [width: number, height: number] | undefined

      the page size in device pixels, if the page records one

      Returns [width: number, height: number] | undefined

    • get readOnly(): boolean

      whether the page can only be read: a version 3 or 5 page, or a damaged one

      Returns boolean

    • get screen(): [width: number, height: number]

      the screen the page was drawn on, upright, in its pixels: the size it records, or the reMarkable 2's for a page that records none

      Returns [width: number, height: number]

    • get textWidth(): number | undefined

      the typed text's width setting, named by TextWidth, if the page records one

      Returns number | undefined

    • how the page's coordinates land on the page shown standing orientation over over, or undefined over a document page whose size is not a finite number above 0

      A version 6 page counts x from the page's center line and, over a document page, 227 of its units to the inch of the PDF page; a version 3 or 5 page counts x from the left edge, fits a document page to the 1404×1872 screen, and records a landscape page on the upright screen, which the transform turns a quarter counterclockwise. The rectangles of a .highlights file count as a version 5 page's do, upright.

      Parameters

      Returns PageTransform | undefined

    • merge other, another copy of the page, into this one; a MergeError if that takes a guess, which leaves the page as it was

      Parameters

      Returns void

    • the page's size as a document standing orientation shows it, taller than the screen for a version 6 page written further down than one screen; the size to lay its template out on

      Parameters

      Returns PageSize

    • read a .rm file; a ReadError if it is not a page this version reads

      Parameters

      • bytes: Uint8Array

      Returns Page