|
| 1 | +rmrl: reMarkable Rendering Library |
| 2 | +=================================== |
| 3 | +rmrl is a Python library for rendering reMarkable documents to PDF files. |
| 4 | +It takes the original PDF document and the files describing your annotations, |
| 5 | +combining them to produce a document close to what reMarkable itself would |
| 6 | +output. |
| 7 | + |
| 8 | +Demo |
| 9 | +---- |
| 10 | +The same notebook was rendered to a PDF via the reMarkable app and rmrl. |
| 11 | +The resultant PDF files were converted to PNGs with ImageMagick at 300 |
| 12 | +dpi. |
| 13 | + |
| 14 | + reMarkable output | rmrl output |
| 15 | +:-----------------:|:-----------: |
| 16 | +[](demo/app.png) | [](demo/rmrl.png) |
| 17 | + |
| 18 | +The biggest differences are the lack of texture in the pencils and paintbrush, |
| 19 | +which we hope to address in the future. The highlight color is also different, |
| 20 | +but we feel the default color is too subtle. |
| 21 | + |
| 22 | +Installation |
| 23 | +------------ |
| 24 | +rmrl requires Python 3.7 or later. If that's installed, the easiest installation |
| 25 | +is to do a |
| 26 | +```bash |
| 27 | +pip install rmrl |
| 28 | +``` |
| 29 | +Alternatively, you should be able to clone this repository and run |
| 30 | +```bash |
| 31 | +pip install -e . |
| 32 | +``` |
| 33 | + |
| 34 | +Usage |
| 35 | +----- |
| 36 | +The main interface to rmrl is through a single function: |
| 37 | +```python |
| 38 | +from rmrl import render |
| 39 | + |
| 40 | +output = render(source) |
| 41 | +``` |
| 42 | +`source` may be: |
| 43 | +- The filename of a zip file containing the document. |
| 44 | +- The filename of any (root-level) file from an unpacked document. |
| 45 | +- Any object that provides `open()` and `exists()` methods. See |
| 46 | + `rmrl/sources.py` for more details on this API. |
| 47 | + |
| 48 | +The output is a filestream with the contents of the PDF file. |
| 49 | + |
| 50 | +The `render` function takes the following keyword arguments: |
| 51 | +- `progress_cb`: A callback function to be called periodically during the |
| 52 | + rendering process. It will be called with a single argument, a number |
| 53 | + from 0 to 100 indicating the progress. This function can abort the |
| 54 | + process by raising an exception. |
| 55 | + |
| 56 | +Command-line Usage |
| 57 | +------------------ |
| 58 | +rmrl may be called as a command-line tool. Once it has been installed, run |
| 59 | +```bash |
| 60 | +python -m rmrl filename |
| 61 | +``` |
| 62 | +to convert `filename` to an annotated PDF. The default output is to stdout. |
| 63 | +Use |
| 64 | +```bash |
| 65 | +python -m rmrl -h |
| 66 | +``` |
| 67 | +to see all of the options. |
| 68 | + |
| 69 | +Templates |
| 70 | +--------- |
| 71 | +rmrl can use the reMarkable templates as a background when rendering notebooks. |
| 72 | +We cannot ship copies of these templates. You may be allowed to copy them from |
| 73 | +your own reMarkable device on to your computer for personal use. If this is |
| 74 | +legal in your jurisdiction, you may connect your device to your computer by the |
| 75 | +USB cable and run |
| 76 | +```bash |
| 77 | +python -m rmrl.load_templates |
| 78 | +``` |
| 79 | +This will copy these templates to `~/.local/share/rmrl/templates` (assuming |
| 80 | +default XDG settings). |
| 81 | + |
| 82 | +History |
| 83 | +------- |
| 84 | +rmrl derives from the [reMarkable Connection Utility](http://www.davisr.me/projects/rcu/), |
| 85 | +by Davis Remmel. RCU is a full-featured GUI for managing all aspects of a |
| 86 | +reMarkable device. Do check it out if you are looking for a stand-alone |
| 87 | +solution for getting documents on and off of your device. |
| 88 | + |
| 89 | +RCU was chosen as a base for rmrl due to its high-quality rendering. The |
| 90 | +following are the major changes: |
| 91 | +- rmrl is designed as a library, for incorporation into other programs. RCU |
| 92 | + is designed as a stand-alone program. |
| 93 | +- rmrl uses the pure-Python [ReportLab Toolkit](https://www.reportlab.com/dev/opensource/rl-toolkit/) |
| 94 | + for rendering PDF files. RCU uses the Qt framework, which is a significantly |
| 95 | + heavier installation. |
| 96 | +- rmrl only supports vector output, while RCU offers both raster and vector |
| 97 | + rendering. |
| 98 | +- RCU supports PDF layers (Optional Content Groups). At this point, rmrl does |
| 99 | + not. |
| 100 | +- RCU can add PDF annotations corresponding to highlights. At this point, rmrl |
| 101 | + does not. |
| 102 | + |
| 103 | +Trademarks |
| 104 | +---------- |
| 105 | +reMarkable(R) is a registered tradebark of reMarkable AS. rmrl is not |
| 106 | +affiliated with, or endorsed by, reMarkable AS. The use of “reMarkable” |
| 107 | +in this work refers to the company’s e-paper tablet product(s). |
| 108 | + |
| 109 | +Copyright |
| 110 | +--------- |
| 111 | +Copyright (C) 2020 Davis Remmel |
| 112 | + |
| 113 | +Copyright 2021 Robert Schroll |
| 114 | + |
| 115 | +This program is free software: you can redistribute it and/or modify |
| 116 | +it under the terms of the GNU General Public License as published by |
| 117 | +the Free Software Foundation, either version 3 of the License, or |
| 118 | +(at your option) any later version. |
| 119 | + |
| 120 | +This program is distributed in the hope that it will be useful, |
| 121 | +but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 122 | +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 123 | +GNU General Public License for more details. |
| 124 | + |
| 125 | +You should have received a copy of the GNU General Public License |
| 126 | +along with this program. If not, see <https://www.gnu.org/licenses/>. |
0 commit comments