Documentation ¶
Index ¶
Constants ¶
const MM_TO_RMPOINTS = 2.83465
Conversion between millimeters and standard postscript points
const PDF_HEIGHT_IN_MM = 297.0000
const PDF_WIDTH_IN_MM = 222.6264
reMarkable png templates (in /usr/share/remarkable/templates) are 1404x1873px or 495.4x660.9mm at 2.834x2.834 pixels/mm reMarkable output PDF sizes with fixed y and variable x use reMarkable png templates as a model
const PTS_2_RMPTS = 2.222 // eyeballed conversion
Conversion from rm pixels to points, theoretically 2.2253
Variables ¶
var LayerRegister = map[string]int{}
Layer names
var StrokeMap = map[int]string{
2: "pen",
4: "fineliner",
3: "marker",
5: "highlighter",
6: "eraser",
7: "mechanical pencil",
8: "erase area",
12: "paint",
13: "mechanical pencil",
14: "pencil",
15: "ballpoint",
16: "marker",
17: "pen",
18: "highlighter",
}
Map of pen numbers in a reMarkable binary .rm file
var StrokeSettings = map[string]StrokeSetting{ "pen": { Colour: colornames.Black, StdWidth: 2.0, Opacity: 1, ColourOverride: true, }, "highlighter": { Colour: colornames.Blue, StdWidth: 15.0, Opacity: 0.4, ColourOverride: true, }, "fineliner": { Colour: colornames.Blue, StdWidth: 1.0, Opacity: 1, ColourOverride: true, }, "marker": { Colour: colornames.Black, StdWidth: 3.8, Opacity: 1, ColourOverride: true, }, "ballpoint": { Colour: colornames.Slategray, StdWidth: 1.75, Opacity: 0.8, }, "pencil": { Colour: colornames.Black, StdWidth: 1.9, Opacity: 1, }, "mechanical pencil": { Colour: colornames.Black, StdWidth: 1.2, Opacity: 0.7, }, "paint": { Colour: color.RGBA{55, 55, 55, 220}, StdWidth: 4.8, Opacity: 0.8, }, "eraser": { Colour: colornames.White, StdWidth: 9.0, Opacity: 0, }, "erase area": { Colour: colornames.White, StdWidth: 9.0, Opacity: 0, }, }
Set of pen default settings
var UnknownPens = make(map[int]int)
Unknown pen register
Functions ¶
func RM2PDF ¶
func RM2PDF(inputpath string, outfile string, template string, isTemplateBundle bool, verbose bool, colours []LocalColour) error
rm2pdf is the main entry point for the programme. It takes a single string pointing to a valid PDF file (or the replacement A4 template) with an associated set of reMarkable metadata and .rm files. It then makes a PDF page for each page in the original PDF (although the template file's first page is recycled) and then adds each layer of the associated page's .rm file on top of that, finally writing the resulting pdf to outfile. Custom colours may be specified for each layer.
Types ¶
type LocalColour ¶
func (*LocalColour) UnmarshalFlag ¶
func (l *LocalColour) UnmarshalFlag(value string) error
func (*LocalColour) Usage ¶
func (c *LocalColour) Usage() string
type StrokeSetting ¶
type StrokeSetting struct { Colour color.RGBA StdWidth float32 Opacity float64 ColourOverride bool }
StrokeSetting describes strokes from an .rm file in a pdf document. Although Colours are defined as RGBA values, they all have solid (255) Alpha values. The width of each stroke is a value representing the medium-sized pen width of each pen type (the middle of three values), although StdWidth is an eyeballed/very approximate value which is further adjusted through StrokeSetting.Width(). In future it may be better to set the widths explictly in this struct. The Alpha value is set separately using the Opacity value. The ColourOverride property determines if the colour of the stroke may be manually overridden by command-line options.
func (*StrokeSetting) Width ¶
func (s *StrokeSetting) Width(penwidth float32) float64
Each rm pen comes in three widths, 1.875, 2.000, 2.125, so provide a fractional width calculation done by eyeballing what seems about right. It probably makes sense to move the widths to the map of pens in future.