Skip to content

Allow creation of markup annotations without a text selection#191

Closed
astoff wants to merge 1 commit into
vedang:masterfrom
astoff:floating-highlight
Closed

Allow creation of markup annotations without a text selection#191
astoff wants to merge 1 commit into
vedang:masterfrom
astoff:floating-highlight

Conversation

@astoff

@astoff astoff commented Feb 11, 2023

Copy link
Copy Markdown
Contributor

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

astoff commented Feb 11, 2023

Copy link
Copy Markdown
Contributor Author

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.
@astoff astoff force-pushed the floating-highlight branch from 6deaa2e to e514833 Compare February 12, 2023 18:06
@ffsammak

ffsammak commented Feb 27, 2023

Copy link
Copy Markdown

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

@astoff

astoff commented Feb 28, 2023

Copy link
Copy Markdown
Contributor Author

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

@vedang What do you think?

@ffsammak

ffsammak commented Feb 28, 2023

Copy link
Copy Markdown

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

ffsammak commented Mar 22, 2023

Copy link
Copy Markdown

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

@vedang

vedang commented Mar 22, 2023 via email

Copy link
Copy Markdown
Owner

@ffsammak

Copy link
Copy Markdown

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

vedang commented Jun 10, 2023

Copy link
Copy Markdown
Owner

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