files

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RMFileInfo

type RMFileInfo struct {
	RelPDFPath           string // full relative path to PDF
	RelPDFPathFH         *os.File
	RelPDFTemplatePath   string // full relative path to PDF template
	RelPDFTemplatePathFH *os.File
	EmbeddedTemplateFH   fs.File // embedded template

	Identifier         string // the uuid used to identify the PDF file
	Version            int    // version from metadata
	VisibleName        string // visibleName from metadata (used in reMarkable interface)
	LastModified       time.Time
	OriginalPageCount  int
	PageCount          int
	Pages              []RMPage
	Orientation        string
	RedirectionPageMap []int // page insertion info

	Debugging bool
	// contains filtered or unexported fields
}

RMFileInfo is a struct defining the collected metadata about a PDF from the reMarkable file collection

func RMFiler

func RMFiler(inputpath string, template string) (RMFileInfo, error)

RMFiler collects information from the reMarkable files associated with the uuid of interest. Either a pdf at <path/uuid.pdf> is expected, or a single A4 page template. If a template is not explictly provided an embedded A4 template is used.

The uuid (identified by its filepath plus <uuid>), is used to collect information from the .metadata and .content files. It then collects layer information for each associated .rm file in a directory named by the uuid of the pdf.

func (*RMFileInfo) Debug

func (r *RMFileInfo) Debug(d string)

Debug prints a message if the debugging switch is on

func (*RMFileInfo) InsertedPages added in v0.0.3

func (r *RMFileInfo) InsertedPages() string

InsertedPages is a public export of the embedded insertedPages human readable page numbers func

func (*RMFileInfo) PageIterate added in v0.0.3

func (r *RMFileInfo) PageIterate() (pageNo, pdfPageNo int, inserted, isTemplate bool, reader *io.ReadSeeker)

PageIterate iterates over pages using the rmfile iterator which provides a page number and the pdf to use (either the annotated pdf or the template). For annotated pdfs with inserted pages one might receive the following output from the iterator:

pageno | pdfPage | inserted | template | -------+---------+----------+---------------+ 0 | 0 | no | annotated.pdf | 1 | 0 | yes | template.pdf | 2 | 1 | no | annotated.pdf |

This function returns 0-indexed pdf pages

Returning an io.ReadSeeker from an fs.File is described by Ian Lance Taylor at https://github.com/golang/go/issues/44175#issuecomment-775545730

type RMPage

type RMPage struct {
	PageNo     int
	Identifier string   // the uuid used to identify the RM file
	RelRMPath  string   // full relative path to the .rm file
	Exists     bool     // file exists on disk
	LayerNames []string // layer names by implicit index
}

RMPage is a struct defining metadata about each .rm file associated with the PDF described in an RMFileInfo. Note that while the .content file records page UUIDs for each page of the original PDF, .rm and related file are only made for those pages which have marks

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL