jmpinit / rm-dl-annotated

Export annotated PDFs from ReMarkable tablets
MIT License
80 stars 5 forks source link

Annotations not in right place if created with cropped view #2

Closed ericsfraga closed 6 years ago

ericsfraga commented 6 years ago

Nice bringing together of a number of tools! And the script works very well generally. However, if you make annotations when the PDF is presented in a cropped view on the tablet, the annotations are not overlaid properly on the PDF when combined.

This may not be a problem with your script as such as. My guess is that the conversion to SVG from .lines does not offset the image using any crop information (assuming that information is available in the first place).

jmpinit commented 6 years ago

Thanks for checking out my tool and for letting me know about this issue. I believe that I have fixed it in 2568c51bb62c609006932926145525b645156817.

Turns out the crop is actually handled by setting a transformation matrix stored in the JSON in the .content file, not in the .lines file (or in the PDF for that matter).

The fix adds some annoying dependencies (Open CV probably being the worst) but it works on the cropped PDFs I've tried. And it checks to see if the PDFs are actually cropped before trying to use the new dependencies, so people without cropped PDFs can do without them.

If you get a chance please let me know if it works for you! For now I'm going to close this issue.