Skip to content
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

Is it possible to support pdf rectangle annotation? #1

Closed
KuiyueRO opened this issue Dec 24, 2023 · 7 comments
Closed

Is it possible to support pdf rectangle annotation? #1

KuiyueRO opened this issue Dec 24, 2023 · 7 comments
Labels
enhancement New feature or request

Comments

@KuiyueRO
Copy link

First of all, thank you for making this useful plugin.

Some PDFs are scanned versions, is there any chance to support partial embedding or highlighting?

Just like

[[xxx.pdf#page=2&area=x1,x2,y1,y2]]
@RyotaUshio
Copy link
Owner

RyotaUshio commented Dec 25, 2023

Thanks for the idea. I do agree such a functionality should be very useful, and it will be technically possible. But I'm worrying about the risk of introducing too much plugin-dependent stuff, because

  • this plugin uses a lot of non-public API of Obsidian and dives very deep into Obsidian's internals, so I has a relatively high risk of breaking when Obsidian is updated.
  • also there is no guarantee that I can continue maintaining this plugin for years.

So I'm trying to be careful when introducing an original notation or something.

A workaround available now is the offset=x,y,z notation, where x,y specifies the upper-left corner position of the embedded area, and z specifies the zoom scale, if I understand correctly. e.g. [[file.pdf#page=1&offset=x,y,z]]

@KuiyueRO
Copy link
Author

KuiyueRO commented Dec 26, 2023

Thanks, I decided to just use #page=3 .

Manually entering x,y,z seems a bit difficult to control.

:)

@RyotaUshio RyotaUshio reopened this Jan 1, 2024
@RyotaUshio
Copy link
Owner

I think rectangle annotation is too important to discard. I do want to add this feature to this plugin.

But as I said, I don't want to go too far away from Obsidian's native syntax.

Given this constraint, another workaround available currently is

  1. First, open a target PDF file in an external PDF viewer application (such as Adobe Acrobat and PDF Expert).
  2. Add a rectangle annotation in this external app.
  3. Go back to Obsidian. Obsidian can link to an annotation with its ID, so you can link to the rectangle that you added in the last step. You can also make the link an embed by prepending ! (but the annotation embed trimming feature has a problem now: When an annotation embed is trimmed, sometimes a part of text contents are not displayed in the embed #9).

Also, maybe this plugin could implement something like:

  1. A user can use a rectangle area selection tool to add a rectangle annotation to a PDF file.
  2. Once the rectangle annotation is embedded into the PDF file, the user can link to the rectangle using Obsidian's native syntax [[file.pdf#page=<PAGE>&annotation=<ANNOTATION ID>]].

This could be doable.

@RyotaUshio RyotaUshio added the enhancement New feature or request label Jan 1, 2024
@KuiyueRO
Copy link
Author

KuiyueRO commented Jan 1, 2024

If Obsidian's native syntax support &width=xxx.

Maybe you can be used [[xxx.pdf#page=1&offset=x,y,z&height=xxx,&width=xxx]].

@RyotaUshio
Copy link
Owner

If Obsidian's native syntax support &width=xxx.

Unfortunately it doesn't. But thanks for the suggestion!

@RyotaUshio
Copy link
Owner

Now that we can add annotations directly into PDFs, we have come a little bit closer to making this happen.

@RyotaUshio
Copy link
Owner

This feature has finally come true in 0.36.0!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants