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

Allow creation of markup annotations without a text selection #191

Closed
wants to merge 1 commit into from

Conversation

astoff
Copy link
Contributor

@astoff astoff commented Feb 11, 2023

I would like to be able to annotate an arbitrary region of the page after selecting it with M-drag-mouse. For instance, the following selection:

image

produces this annotation

image

I would rather be able to do this:

image

Perhaps this would be better achieved with a "Square" annotation, which epdfinfo doesn't support (although apparently poppler does). Lacking that, however, a highlight annotation seem suitable.

EDIT: In the updated version of this PR, the red annotation can created by calling pdf-annot-add-highlight-markup-annotation when the region is a rectangle (if multiple rectangles are selected, only the first is used). We could add a customization option to preserve the original behavior, but I think I would rather wait and see if anyone complains.

Do you think this is a good approach, given that adding the other annotation types would be a much bigger effort?

@astoff astoff mentioned this pull request Feb 11, 2023
@astoff
Copy link
Contributor Author

astoff commented Feb 11, 2023

One more thought concerning Square annotations: those appear over the text, so really serve a different purpose. One could simulate the red annotation of the screenshot above using a square annotation with transparency, but it's not quite the same thing.

This allows calling 'pdf-info-addannot' from Lisp with a nil
'markup-edges' argument, which was previously disallowed.  In this
case, the annotation covers exactly the selected region of the page,
with not attempt to match it to a certain text region.
@ffsammak
Copy link

ffsammak commented Feb 27, 2023

would this nice feature be useful if I have a scanned pdf, not OCR, only old scanned pdfs as image?

@astoff
Copy link
Contributor Author

astoff commented Feb 28, 2023

Exactly, that's one of the main use-cases.

@vedang What do you think?

@ffsammak
Copy link

ffsammak commented Feb 28, 2023

Wow! that would be a great addition to the already impressive pdf-tools. So in a scanned pdf, no text layer, I can add a rectangular highlight on the desired place inside the image PDF and then when I click on that rectangle I can add some text annotation. That is a long-awaited feature. This is in fact the only single reason I still use Foxitreader beside pdf-tools. Look forward to your great addition.

@ffsammak
Copy link

ffsammak commented Mar 22, 2023

@astoff Hi, has this great feature been merged upstream? Just wondering why not. Take care.

@vedang
Copy link
Owner

vedang commented Mar 22, 2023 via email

@ffsammak
Copy link

Hi! This feature has not been merged upstream because I haven't been able to make the time for it. I'm hoping to make some time next month to clean up a lot of pending work on pdf-tools. Sorry for the delay on this! Thanks, Vedang

On Wed, Mar 22, 2023 at 7:54 PM FFS @.> wrote: @astoff https://github.com/astoff Hi, has this great feature been merged upstream? Just wondering. Take care. — Reply to this email directly, view it on GitHub <#191 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAUUHUQNZB5666CDYC4Z6LW5MDQLANCNFSM6AAAAAAUYZLW2E . You are receiving this because you were mentioned.Message ID: @.>
-- Cheers, Vedang https://vedang.me @vedang on Twitter

Thanks for the reassuring reply, just can't wait. Best.

@vedang
Copy link
Owner

vedang commented Jun 10, 2023

This change looks good to me and I'm merging it in. Thanks @astoff !

@vedang vedang closed this in 97cffdd Jun 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants