ricklupton / rmc

Convert to/from v6 .rm files from the reMarkable tablet
MIT License
57 stars 14 forks source link

Page is cropped vertically when converting, losing the bottom third of the page #8

Open ericsfraga opened 1 year ago

ericsfraga commented 1 year ago

I have an .rm file which is a set of annotations on a PDF file that I uploaded to the tablet. When I convert the rm file using rmc (installed with pipx rmc), the resulting image in PDF is cropped vertically, containing only the top two thirds (guesstimate) of the page. The SVG version, however, does have all the content.

I think this has something to do with the width and height being larger than a standard A4 page (say) so maybe it's really a problem with the tools that display PDF documents... If so, apologies for the noise.

I'm happy to provide the .rm file if you wish as well as the original (1 page) PDF and the PDF that the tablet generates with the annotations.

ericsfraga commented 1 year ago

I've been playing around with your code. For the document in question, the y dimension is strange. If I turn debugging on, I get this output at the start:

xmin: -681.7701416015625 xmax: 927.3253784179688 ymin: 1231.4434814453125 ymax: 2448.491943359375
height: 1872 width: 1610 xpos_delta: 702.0 ypos_delta: 0

so because the difference between ymax and ymin is less than the screen height, the screen height is used as the height. Just thinking out loud here...

ricklupton commented 1 year ago

Thanks for reporting! Yes sharing the files would be helpful.

ricklupton commented 1 year ago

Getting the coordinate origin right is a bit tricky with the different resolutions, page sizes, text anchors, etc, so if it’s a nonstandard page size maybe the code doesn’t account for that properly at the moment.

ericsfraga commented 1 year ago

I cannot attach the .rm file. Please email me (e.fraga@ucl.ac.uk) and I will send the PDF and the .rm file directly, if you wish.

I've been playing quite a bit with your code, adding the capability to scale the vector drawing of the rm file to fit the original PDF. I'm cleaning up my additions to the code and generalising it for this purpose and will share when done.