Skip to main content

remarkable-annotations

Read and write the annotations of reMarkable documents: pen strokes and text highlights on PDF pages, stored as .rm version 6 scene files.

One Rust library, published for three languages:

Language Package Built from
Rust remarkable-annotations (crates.io) this crate
JavaScript remarkable-annotations (npm, WebAssembly) wasm/ (wasm-bindgen)
Python remarkable-annotations (PyPI) src/py (PyO3, maturin)

The library does no I/O: it works on bytes, so it runs the same in a browser, in privileged Firefox code (a Zotero plugin), in Node and in Python.

Status: early. Done: .rm v6 scenes, page annotations (reading, rewriting pages), shape detection, coordinates and PDF page sizes, and a reMarkable cloud client (sans-I/O). All of it is ported from the TypeScript implementation in zotero-remarkable-sync, and tested against it.

Used by

  • zotero-remarkable-sync, a Zotero plugin that syncs annotations between Zotero and a reMarkable tablet. It uses the JavaScript (WebAssembly) package for the .rm scenes, the pages and the reMarkable cloud client.

Scenes

use remarkable_annotations::scene::Scene;

let bytes = std::fs::read("page.rm")?;
let scene = Scene::parse(&bytes)?;
assert_eq!(scene.serialize(), bytes); // byte for byte

Writing back an unmodified scene gives the input bytes: blocks that fail to parse are kept raw, each block keeps its unread tail, and wire details with no meaning (string ASCII flags, absent optional fields) are kept as read.

Reading and writing pages

page::parse_page (parsePage in JavaScript) maps a page's blocks to strokes (line items) and highlights (glyph ranges). Each comes with its scene item ids, so a caller can remove it later.

page::rebuild_page (rebuildPage) drops the items whose id is in remove, keeps every other block as is, then appends the new items (highlights first) after the layer's last item. It returns the ids it gave them.

A page without a .rm file gets one from a template: split_structure copies another page's structure without its items, and blank_structure builds one from scratch.

Rules the tablet enforces

These were checked on a real tablet:

  • Counters: new items must use counters above every counter on the page, whatever their author (max_counter covers tombstones and groups too). The tablet drops the others when it loads the page.
  • Authors: item ids are (author, counter), and the author is a byte, so a page holds at most 255 authors. Authors added to the page's author table (PageUpdate::register) survive tablet saves. An erased item leaves a tombstone that keeps its author id.
  • Per-item authors: PageUpdate::authors sets the author of each added item. The Zotero plugin uses this to tag each item with the annotation it mirrors (an author uuid encoding the Zotero key).

Pages and PDF pages

A document's .content gives the page order (pages, or cPages.pages without deleted pages) and the redirectionPageMap, which maps reMarkable pages to PDF pages; each page's annotations are in {pageUuid}.rm. Page tags (the tablet's tag-a-page feature) name the page they belong to.

Coordinates

The tablet renders a PDF at a fixed resolution (RM_DPI = 226, calibrated on an rM2) and stores coordinates in those device pixels, with x measured from the page centre and y from the top. geometry converts them to PDF points (origin bottom-left) with a single scale:

pdfX = rmX * 72/RM_DPI + x0 + pageWidth/2
pdfY = y0 + pageHeight - rmY * 72/RM_DPI

The mapping was checked against a real export: highlight rectangles matched the PDF's vectors within 1 pt. Pen widths use a factor fitted the same way (ink_width, pdf_width_to_rm).

read_pdf_page_sizes gives each page's visible size. It walks the PDF's page tree (pdf), expanding compressed object streams and honouring inherited boxes. If that fails, it falls back to a plain-text scan of /MediaBox, then to US Letter.

Cloud

cloud is a reMarkable cloud client that does no I/O: each operation hands the host the HTTP requests to make, and continues with the responses. Where rmapi-js runs requests in parallel (Promise.all: listing items, a document's metadata and content, page uploads), the operation hands them over together as a batch, which the host runs concurrently; listing 50 documents takes 4 round trips. The host also provides the clock and uuids. The same client runs in a browser, in privileged Firefox code, in Node and in Python.

import init, { CloudSession, cloudAuth } from "remarkable-annotations";

async function perform(item) {
  // a request, or a sleep before a retry
  if (item.type === "sleep") {
    await new Promise((ok) => setTimeout(ok, Math.random() * item.ms));
    return undefined;
  }
  const r = await fetch(item.url, { method: item.method, headers: item.headers, body: item.body });
  return { status: r.status, statusText: r.statusText, body: new Uint8Array(await r.arrayBuffer()) };
}

async function run(op) {
  for (let step = op.start(); ; ) {
    if (step.type === "batch") step = op.resumeBatch(await Promise.all(step.items.map(perform)));
    else if (step.type === "request" || step.type === "sleep") step = op.resume(await perform(step));
    else if (step.type === "done") return step; // json, bytes or text
    else throw step.error; // {kind: "generation" | "hashNotFound" | "response" | ..., message}
  }
}

const { text: token } = await run(cloudAuth(deviceToken));
const session = new CloudSession(token);
const items = JSON.parse((await run(session.listItems(false))).json);

Operations: listItems, listRefs, getContent, getMetadata, getEntries, getHash, putPdf, putFolder, updateDocument, move, purge, putRmPages (one commit; hashNotFound if the document changed), and the document helpers uploadPdf (with the full page list), ensureFolder, fetchAnnotations and mapPdfPages; cloudRegister and cloudAuth for tokens. Generation conflicts and transient errors are retried as rmapi-js does.

The protocol is rmapi-js's, ported operation by operation. cloud-check.mjs runs rmapi-js and this client side by side on fake clouds (fakecloud.mjs): accounts on schema 3 and 4, reads, writes, errors, transient failures, and other devices writing at the same time. Both must return the same results (as JSON text) and leave the same cloud, byte for byte.

Tests

cargo test                          # Rust
uv venv && uv pip install maturin pytest && maturin develop --uv && pytest  # Python

The fixtures in tests/fixtures/rm are real tablet pages (from rmscene) and pages written by the TypeScript implementation. For each one, the tests check that:

  • it round-trips byte for byte;
  • the parsed blocks are those of rmapi-js (X.rmapi.json, written by tests/reference/dump.mjs);
  • corrupted copies (bytes changed, inserted, removed, truncated) still parse and round-trip, without panics.

The page, geometry, shape and PDF modules are compared with the TypeScript implementation: page-dump.mjs and geometry-dump.mjs record its results (annotations of every fixture, rebuilt pages byte for byte, shapes, coordinate conversions, page sizes of the PDFs in tests/fixtures/pdf, made by gen-pdfs.py).

License

Licensed under either of the MIT license or the Apache License, Version 2.0, at your option. See NOTICE for the projects this one derives from.

Metadata

Release files for remarkable-annotations 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for remarkable-annotations 0.1.0
File Size Uploaded Provenance Actions
remarkable_annotations-0.1.0.tar.gz 727.6 kB With provenance Details for remarkable_annotations-0.1.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for remarkable-annotations 0.1.0
File Actions
remarkable_annotations-0.1.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for remarkable_annotations-0.1.0-cp310-abi3-win_amd64.whl
remarkable_annotations-0.1.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details for remarkable_annotations-0.1.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
remarkable_annotations-0.1.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details for remarkable_annotations-0.1.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
remarkable_annotations-0.1.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for remarkable_annotations-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
remarkable_annotations-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details for remarkable_annotations-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl

Total release size: 4.8 MB

Release files / remarkable_annotations-0.1.0.tar.gz

Download URL remarkable_annotations-0.1.0.tar.gz
Size 727.6 kB
Tags Source
SHA-256 checksum
How to use checksums
dfc08e1c91a6d4c1d9bbe56ccf013d7a9ae8c3049d4b00a4e1487d4acf175a1c
BLAKE2b-256 checksum
How to use checksums
7e14e364fdbfaa47748a06ae6e29b3bf4a1349e723f6df54300ff0294a29db7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / remarkable_annotations-0.1.0-cp310-abi3-win_amd64.whl

Download URL remarkable_annotations-0.1.0-cp310-abi3-win_amd64.whl
Size 763.5 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
e107430f34d7f7428be0a91fa53686458d1a981d7dc7b091e2bf62a6df665845
BLAKE2b-256 checksum
How to use checksums
addba9e2ecfb646cccae4c4d2adfa6cbc8f5ac6ab6062b8fdb6ee1fe53fe02f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / remarkable_annotations-0.1.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL remarkable_annotations-0.1.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 868.3 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
390bc274179c3a443f7da7b23e855d00eb1d9508b4f4be63b8e9206b4e1d71b4
BLAKE2b-256 checksum
How to use checksums
36065cc9ab22bb3c98309903834a23cd3dc22ba6406c2e968901975fad6267ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / remarkable_annotations-0.1.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL remarkable_annotations-0.1.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 825.9 kB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
ab4751ce10e8e8833b38c81275f6dae6a1bea735ee78444303c1eab8a9e156bc
BLAKE2b-256 checksum
How to use checksums
e1c560edbdefcc5181fcd21877c4f191bf8919985aebcc7f1056d99329be65a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / remarkable_annotations-0.1.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL remarkable_annotations-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
Size 783.4 kB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f6400f729d6757ddfde089a41c8fb57c2d87f26040833d0b9eee1a057534748e
BLAKE2b-256 checksum
How to use checksums
e88bbdf735929b4fdd611853f810e4449dc4b9826125945b9413dd610c780c9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / remarkable_annotations-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl

Download URL remarkable_annotations-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl
Size 839.9 kB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
39da4ea7c570745a7ab962276c3c8b79b085fe68b48da7d7d8adbccebff4fe30
BLAKE2b-256 checksum
How to use checksums
e91cbddfae09c114897c117186aa81a979e2f5e5193cdedeb7e067a2676e652e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Security for remarkable-annotations 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for remarkable_annotations-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

6 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page