-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problems with coordinates #5
Comments
Bug bounty pooling money for large contributions to this issue
|
I am working on a project that involves exporting PDF documents with annotations made with the reMarkable 2.
SCREEN_WIDTH: float = 1404
SCREEN_HEIGHT: float = 1872
SCREEN_DPI: float = 226
SCALE: float = 72.0 / SCREEN_DPI
def rm_to_svg(input: BytesIO, **kwargs: Any) -> str:
"""Converts a remarkable .lines file to a svg string."""
blocks = read_blocks(input)
return blocks_to_svg(blocks, **kwargs)
def to_pts(x: float) -> float:
"""Convert unit to pts."""
return x * SCALE
def from_pts(x: float) -> float:
"""Convert unit from pts."""
return x / SCALE
# using pypdf (background is a pypdf PageObject)
box = background.mediabox
width, height = from_pts(box.width), from_pts(box.height)
rm_str = rm_to_svg(b, width=width, height=height)
thispage = convert(rm_str.encode(), "svg")[0] # convert the svg to pdf
thispage.scale_to(to_pts(SCREEN_WIDTH), to_pts(SCREEN_HEIGHT))
thispage.merge_page(background) Cheers |
Hi, all. I encountered this issue as part of a prototype that involved rendering reMarkable lines. The failing scenario is easy to construct, at least for the class of issue I encountered: open a PDF which is in an aspect ratio other than 3:4 (i.e. distinct from the device), and draw in the margins to the edge of the page. You'll also see the failure if you adjust the viewport so that you're drawing "above" or "below" the PDF's crop box. Both The good news is that I fixed the problem in my implementation. The bad news is that my implementation is part of a hacky interaction design prototype and is implemented in terms of imperative But the key insight which let me fix this bug was to understand how the reMarkable document coordinate system actually works. Once I understood that, I could see that naively layering an SVG on top of the underlying PDF can't work in the general case. The origin of the SVG isn't necessarily the origin of the PDF, and the simple transform-x-by-half-the-page-width adjustment in these implementations only works in some cases. Here's how the coordinate system works:
The tricky bit here is that if you make an SVG comprising all the annotations, you can't just assume that the upper-left corner of the SVG coincides with the upper-left corner of the PDF. They need to be composited to match the coordinate system I described above. I hope that helps! |
@andymatuschak Andy, what an honor to have you here, oh my God! You literally popped up at the perfect time! I've been busy studying Joe Edelman's values-based social design for meaning. I've been trying to get in contact with him or them for a good time now, but I've been unable to do so for too long. I've tried
None of it is working. All the tech is broken, lmao. I even emailed Joe about 8 years ago about a potential internship with him. Wasn't happening! I'm working on the constitution of a business model, which is values based. I'd love to get feedback on it from someone with experience, so preferably from someone at the school for social design! Or a graduate (which you are! :D) |
What's the problem?
Highlights and annotations on ebooks and PDFs are not positioned correctly on output documents in Scrybble :(
This is by far the worst issue that Scrybble has. And despite trying my best two times, I failed to solve it two times. It's definitely not an insurmountable problem, but it's clearly difficult.
What does the problem look like?
Why is it hard?
ReMarkable's binary format for annotations is simply put, a mess. The biggest issue is that it is hard to understand.
For a start:
Who have expertise in this area?
Pooling money
I'm not sure how to pool money, but I'm thinking of making Scrybble work on a sort of bug-bounty system. If you make an important contribution, you get paid with the money that I gather from Scrybble income.
I hereby pledge 250$ towards this issue.
Who are affected by this issue
In the past week alone, I have received two e-mails by Scrybble users who have run into this issue. Especially this e-mail really hit me hard. It has continued to be an issue for a long, long time.
(emphasis mine)
Related issues
ricklupton/rmscene#27
The text was updated successfully, but these errors were encountered: