Giter Club home page Giter Club logo

rm2pdf's People

Contributors

rorycl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rm2pdf's Issues

SIGSEGV in version 0.14 : support old rmapi zip file format and lack of .metadata files

rm2pdf version 0.1.4:

> rm2pdf -v tst.zip outputtst_14.pdf
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x48f754]

goroutine 1 [running]:
io.ReadAll({0x0, 0x0})
        /usr/lib/go-1.18/src/io/io.go:645 +0xd4
github.com/rorycl/rm2pdf/files.RMFiler({0x7ffce153a16a, 0x7}, {0x0, 0x0})
        /home/rory/src/go-rm2pdf/files/files.go:278 +0x3bd
github.com/rorycl/rm2pdf/rmpdf.RM2PDF({0x7ffce153a16a?, 0x1?}, {0x7ffce153a172, 0x10}, {0x0?, 0x200000003?}, {0x0, 0x0}, 0x1, {0x0, ...})
        /home/rory/src/go-rm2pdf/rmpdf/pdf.go:260 +0x9e
main.main()
        /home/rory/src/go-rm2pdf/main.go:63 +0x157

or (tst.zip extracted)

> rm2pdf -v ddae88d1-7514-43b6-b7de-dcdd18eeb69a outputdd_14.pdf   
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x48f754]

goroutine 1 [running]:
io.ReadAll({0x0, 0x0})
        /usr/lib/go-1.18/src/io/io.go:645 +0xd4
github.com/rorycl/rm2pdf/files.RMFiler({0x7fff7699314e, 0x24}, {0x0, 0x0})
        /home/rory/src/go-rm2pdf/files/files.go:278 +0x3bd
github.com/rorycl/rm2pdf/rmpdf.RM2PDF({0x7fff7699314e?, 0x1?}, {0x7fff76993173, 0xf}, {0x0?, 0x200000003?}, {0x0, 0x0}, 0x1, {0x0, ...})
        /home/rory/src/go-rm2pdf/rmpdf/pdf.go:260 +0x9e
main.main()
        /home/rory/src/go-rm2pdf/main.go:63 +0x157

rm2pdf version 0.1.3 did work:

> rm2pdf013 -v ddae88d1-7514-43b6-b7de-dcdd18eeb69a outputdd_13.pdf 
processing page 0 0 inserted false template true
 rm page 1 pdf page 1
orientation portrait
rmfile ddae88d1-7514-43b6-b7de-dcdd18eeb69a/0.rm
Beginning layer 1
Maximum coordinates : {X:379.57184 Y:133.96654}

Tested on OpenSuse Leap 15.3

go version
go version go1.19.1 linux/amd64

tst.zip

Cannot import page from original PDF

When using rm2pdf to import a PDF, the import sometimes fails with a panic.

The panic message typically includes the text "Expected xref to start with 'xref'".

This appears to be due to gofpdi #16, which is caused by gofpdi not supporting xref streams.

Action:

  • Consider changing how PDFs are imported,
  • or help fix the xref stream problem

Support for .rm version 6 files

Hello @rorycl,

I'm hitting the following error for a couple of files I have in my remarkable 2 (most of them work though):
number of rm pages 0 != json pageCount <x> code line here

Some files are new some are old, I couldn't see a pattern still. I can't upload them here unfortunately, but I'll try to reproduce with a mock file and upload it here if I can reproduce it.

Maybe remarkable changed their file formats? Is the cause known?

Idea

Hi Rory, Just wondering if you could reverse this, so that you can convert pdf to rm format the idea being that I want to make a ui kit that I can use to copy paste symbols or shapes into new pages. is it possible?

support missing pageuuid-metadata.json files

Issue reported by qwert2003.

Doing some more tests on backupped "real" notebooks I have noticed that prior to 2022 sometimes the pageuuid-metadata.json file is missing (for the last page actually). This is not related to rmapi, it seems the rM tablet did just not create that page metadata file in some circumstances. Could you ignore missing pageuuid-metadata.json files too?

Colour names are not over-ridden consistently

Running rm2pdf, for example as follows

./rm2pdf -c Cadetblue -c Indianred \
    -t templates/A4.pdf \
    /remark/aab36d9c-0510-4af1-b5a4-aa7e549b9e8b \
    test.pdf

Does not work as expected.

Parse error with empty layers

It seems that if any page other than the last page has an empty layer with a non-empty layer above it (ie with a higher layer number), then the parser crashes with EOF. See the stack dump below. My workaround is to put a small, almost unnoticeable, dot in the first layer but it's not a great solution. I've never used Go before, nor do I have any idea about the format it needs to parse, but if you don't have the time/inclination to look into it then I'll give it a go.

/Users/ben/Library/Application Support/remarkable/desktop/17aae37e-1418-4d4e-bf5e-176d244b26a3.pdf page 1
rmfile /Users/ben/Library/Application Support/remarkable/desktop/17aae37e-1418-4d4e-bf5e-176d244b26a3/54b559eb-ac14-42a4-bb7f-58184c25cc61.rm
Maximum coordinates : {X:1215.938 Y:1546.1228}

/Users/ben/Library/Application Support/remarkable/desktop/17aae37e-1418-4d4e-bf5e-176d244b26a3.pdf page 2
rmfile /Users/ben/Library/Application Support/remarkable/desktop/17aae37e-1418-4d4e-bf5e-176d244b26a3/7a1eccc0-bd82-4378-98d2-456565e64486.rm
Maximum coordinates : {X:1215.938 Y:1546.1228}

/Users/ben/Library/Application Support/remarkable/desktop/17aae37e-1418-4d4e-bf5e-176d244b26a3.pdf page 3
rmfile /Users/ben/Library/Application Support/remarkable/desktop/17aae37e-1418-4d4e-bf5e-176d244b26a3/1d0019ec-62b0-4e37-96ba-fddc773aa81c.rm
Maximum coordinates : {X:1236.65 Y:1546.1228}

/Users/ben/Library/Application Support/remarkable/desktop/17aae37e-1418-4d4e-bf5e-176d244b26a3.pdf page 4
rmfile /Users/ben/Library/Application Support/remarkable/desktop/17aae37e-1418-4d4e-bf5e-176d244b26a3/7fa42b36-da00-4e1d-875f-39a8bba315f9.rm
Maximum coordinates : {X:1375.4968 Y:1813.187}

/Users/ben/Library/Application Support/remarkable/desktop/17aae37e-1418-4d4e-bf5e-176d244b26a3.pdf page 5
rmfile /Users/ben/Library/Application Support/remarkable/desktop/17aae37e-1418-4d4e-bf5e-176d244b26a3/aaa0a87f-e625-4940-9b81-2d7300ce85d0.rm
panic: EOF

goroutine 1 [running]:
github.com/rorycl/rm2pdf/rmparse.ParseSegment(0xc0001ac128, 0x0, 0x0, 0x0, 0x0, 0x0)
/Users/ben/Desktop/RemarkableColourTest/rm2pdf/rmparse/rmparse.go:251 +0x1d7
github.com/rorycl/rm2pdf/rmparse.(*RMFile).Parse(0xc0001ba000, 0x11dad47)
/Users/ben/Desktop/RemarkableColourTest/rm2pdf/rmparse/rmparse.go:174 +0x165
github.com/rorycl/rm2pdf/rmpdf.constructPageWithLayers(0xc00020e0e0, 0x62, 0x7ffeefbff9c5, 0x24, 0x2a, 0xc00021a000, 0x85, 0x0, 0xed7f296f7, 0x1301ec0, ...)
/Users/ben/Desktop/RemarkableColourTest/rm2pdf/rmpdf/pdf.go:122 +0x739
github.com/rorycl/rm2pdf/rmpdf.RM2PDF(0x7ffeefbff98b, 0x5e, 0x7ffeefbff9ea, 0xa, 0x0, 0x0, 0x1, 0xc0001ae2a0, 0x3, 0x4, ...)
/Users/ben/Desktop/RemarkableColourTest/rm2pdf/rmpdf/pdf.go:227 +0x2f7
main.main()
/Users/ben/Desktop/RemarkableColourTest/rm2pdf/main.go:74 +0x138

Issue with RM2 or me?

I copied the whole xochitl folder to my machine with scp -r remarkable:~/.local/share/remarkable/xochitl ..

Then I run ./rm2pdf-darwin-arm64 ../xochitl/b9b3e2fe-89b0-4d6c-8613-f95710aa4526.pdf output.pdf and get the following error

panic: Failed to initialize parser: Failed to read pdf: Failed to read xref table: Failed to read prev xref: Failed to read prev xref: Failed to read prev xref: Unsupported /DecodeParms - only tested with /Columns <= 4 and /Predictor <= 12

goroutine 1 [running]:
github.com/phpdave11/gofpdi.(*Importer).SetSourceStream(0x14000121500, 0x140001d0500)
	/home/rory/go/pkg/mod/github.com/phpdave11/[email protected]/importer.go:95 +0x1b4
github.com/jung-kurt/gofpdf/contrib/gofpdi.(*Importer).ImportPageFromStream(0x1400011c590, {0x102ba0738, 0x14000193000}, 0x3?, 0x3?, {0x102affcb6, 0x9})
	/home/rory/go/pkg/mod/github.com/jung-kurt/[email protected]/contrib/gofpdi/gofpdi.go:54 +0x44
github.com/jung-kurt/gofpdf/contrib/gofpdi.ImportPageFromStream(...)
	/home/rory/go/pkg/mod/github.com/jung-kurt/[email protected]/contrib/gofpdi/gofpdi.go:124
github.com/rorycl/rm2pdf/rmpdf.constructPageWithLayers({{0x1400017e340, 0x33}, 0x1400011c688, {0x0, 0x0}, 0x0, {0x102ba00b0, 0x140001d0220}, 0x0, {0x16d47add1, ...}, ...}, ...)
	/home/rory/src/go-rm2pdf/rmpdf/pdf.go:91 +0x2b4
github.com/rorycl/rm2pdf/rmpdf.RM2PDF({0x16d47adc6?, 0x14000106190?}, {0x16d47adfa, 0xa}, {0x0?, 0x102988ff8?}, {0x0, 0x0}, 0x0, {0x0, ...})
	/home/rory/src/go-rm2pdf/rmpdf/pdf.go:342 +0x318
main.main()
	/home/rory/src/go-rm2pdf/main.go:82 +0x14c

remarkable2 1.14
macOS 12.6 (ARM)

Build/Test not running

Hi,

thanks for your work! This ist exactly what I am loking for as I regulary sync my remarkable to my linux system and want to convert the notebooks by batch :)

However I cannot get it built:

root@: /tmp/rm2pdf# go test -v ./...
main.go:12:2: cannot find package "github.com/jessevdk/go-flags" in any of:
        /usr/lib/go-1.10/src/github.com/jessevdk/go-flags (from $GOROOT)
        /root/go/src/github.com/jessevdk/go-flags (from $GOPATH)
main.go:14:2: cannot find package "github.com/rorycl/rm2pdf/rmpdf" in any of:
        /usr/lib/go-1.10/src/github.com/rorycl/rm2pdf/rmpdf (from $GOROOT)
        /root/go/src/github.com/rorycl/rm2pdf/rmpdf (from $GOPATH)
files/files.go:14:2: cannot find package "github.com/google/uuid" in any of:
        /usr/lib/go-1.10/src/github.com/google/uuid (from $GOROOT)
        /root/go/src/github.com/google/uuid (from $GOPATH)
rmpdf/pdf.go:13:2: cannot find package "github.com/jung-kurt/gofpdf" in any of:
        /usr/lib/go-1.10/src/github.com/jung-kurt/gofpdf (from $GOROOT)
        /root/go/src/github.com/jung-kurt/gofpdf (from $GOPATH)
rmpdf/pdf.go:14:2: cannot find package "github.com/jung-kurt/gofpdf/contrib/gofpdi" in any of:
        /usr/lib/go-1.10/src/github.com/jung-kurt/gofpdf/contrib/gofpdi (from $GOROOT)
        /root/go/src/github.com/jung-kurt/gofpdf/contrib/gofpdi (from $GOPATH)
rmpdf/pdf.go:17:2: cannot find package "github.com/rorycl/rm2pdf/files" in any of:
        /usr/lib/go-1.10/src/github.com/rorycl/rm2pdf/files (from $GOROOT)
        /root/go/src/github.com/rorycl/rm2pdf/files (from $GOPATH)
rmpdf/pdf.go:16:2: cannot find package "github.com/rorycl/rm2pdf/rmparse" in any of:
        /usr/lib/go-1.10/src/github.com/rorycl/rm2pdf/rmparse (from $GOROOT)
        /root/go/src/github.com/rorycl/rm2pdf/rmparse (from $GOPATH)
rmpdf/localcolour.go:12:2: cannot find package "golang.org/x/image/colornames" in any of:
        /usr/lib/go-1.10/src/golang.org/x/image/colornames (from $GOROOT)
        /root/go/src/golang.org/x/image/colornames (from $GOPATH)

It seems dependencies are missing (?) Sorry, I am not familiar with go :(

I am using an odroid C2 running ubuntu 18.
root@: /tmp/rm2pdf# uname -a Linux 3.16.78-48 #1 SMP PREEMPT Thu Dec 5 07:27:42 -02 2019 aarch64 aarch64 aarch64 GNU/Linux

Can you give me a hint?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.