Documentation ¶
Index ¶
Constants ¶
const MMtoRMPoints = 2.83465
MMtoRMPoints is the conversion between millimeters and standard postscript points
const PDFHeightInMM = 297.0000
PDFHeightInMM is the width of a PDF in millimetres
const PDFWidthInMM = 222.6264
PDFWidthInMM is the width of a PDF in millimetres
const Pts2RMPoints = 2.222 // eyeballed conversion
Pts2RMPoints is the conversion from rm pixels to points, theoretically 2.2253
Variables ¶
var LayerRegister = map[string]int{}
LayerRegister is a Layer names
var StrokeMap = map[int]string{
2: "pen",
4: "fineliner",
3: "marker",
5: "highligher",
6: "eraser",
7: "sharp pencil",
8: "erase area",
12: "paint",
13: "mechanical pencil",
14: "pencil",
15: "ballpoint",
16: "marker",
17: "pen",
18: "highlighter",
}
StrokeMap is a 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, }, }
StrokeSettings sets the pen default settings
var UnknownPens = make(map[int]int)
UnknownPens is an unknown pen register
Functions ¶
func RM2PDF ¶
func RM2PDF(inputpath, outfile, template, settings string, 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. Settings may also be supplied from a settings configuration file.
Types ¶
type LocalColour ¶
LocalColour describes a color by name and RGBA value
func (*LocalColour) UnmarshalFlag ¶
func (l *LocalColour) UnmarshalFlag(value string) error
UnmarshalFlag generates the colour value for a colour 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) NaturalWidth ¶ added in v0.1.2
func (s *StrokeSetting) NaturalWidth(penwidth float32) string
NaturalWidth reports pen widths as "narrow", "standard" or "broad"
func (*StrokeSetting) Width ¶
func (s *StrokeSetting) Width(penwidth float32) float64
Width sets pen widths. 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.