Print to the reMarkable Cloud from a Fedora computer
2019 May 16
I recently picked up a reMarkable tablet and am really enjoying it! One neat thing is that it is well-integrated with a backing cloud service, so that with the right setup you can “print” from a computer straight to the reMarkable. Here’s a setup that worked for my Fedora machine. The directions are primarily derived from the remarkable-cups instructions put together by Mark Meyer.
Note: This is post-facto and is probably missing some steps.
-
Several SELinux-y steps that may be somewhat confused:
- Copy/move the binary to
/usr/bin
. - Set its SELinux permissions:
sudo /sbin/restorecon -v /usr/bin/rmapi
. - Move it to
/var/spool/lpd/rmapi
. - We can probably just leave it in
/usr/local/bin
or something; note however that the driver script below hardcodes the executable path.
- Copy/move the binary to
-
Set up the following script as
/usr/lib/cups/backend/remarkable
, owned by root, permissions 755 or so:#!/bin/bash # # Derived from: # # https://github.com/ofosos/scratch/blob/master/remarkable-cups/remarkable.sh backend="$0" jobid="$1" cupsuser="$2" jobtitle="$3" jobcopies="$4" joboptions="$5" jobfile="$6" rmapi=/var/spool/lpd/rmapi printtime="$(date +"%Y%m%d.%H%M")" sanitized_jobtitle="$(echo "$jobtitle" | tr / _)" outname=/tmp/"$sanitized_jobtitle - ${printtime}.pdf" if [ $# -eq 0 ] ; then # this case is for "backend discovery mode" echo "Remarkable Printer \"Mark Meyer\" \"Backend to print directly to Remarkable cloud\"" exit 0 fi if [ -z "$jobfile" ] ; then jobfile=- fi cat "$jobfile" >"$outname" "$rmapi" put "$outname" "${DEVICE_URI#remarkable:}" rm "$outname" echo 1>&2 exit 0
-
Follow the instructions on the remarkable-cups README to generate a
remarkable.ppd
file, and place it in/etc/cups/ppd
. Permissions should be 0o640, ownerroot
, and grouplp
. -
Might need to
restorecon
the PPD and/or backend file as well. -
Reload or restart CUPS to pick up the new configuration.
-
Add a new printer using your preferred interface. Use a device URI of
remarkable:/Printouts
. May need to installsystem-config-printer
. -
Log in to the reMarkable cloud using
rmapi
to generate~/.rmapi
. -
Copy
~/.rmapi
to/var/spool/lpd/.rmapi
and chown tolp:lp
. -
Possible
restorecon
that file as well?
To update the rmapi
binary (if it needs rebuilding or a bugfix), it should
work just to repeat the first few steps above.
Update 2020-May-29: It seems that the most recent versions of rmapi
care
about the extension of the filename that you upload. I’ve modified the above
script to hardcode .pdf
. Maybe it needs to be smarter?