mozilla / pdf.js

PDF Reader in JavaScript
https://mozilla.github.io/pdf.js/
Apache License 2.0
48.34k stars 9.97k forks source link

Contents of annotations not (completely) visible #10677

Closed rakeshkasinathan closed 5 years ago

rakeshkasinathan commented 5 years ago

I have not used any external library, i have used acrobat reader to annotate, insert and delete. I had taken the screenshot form your demo link only. Here by i will attach my pdf file as well as screenshot of demo link which you have given in the GitHub.

Passasjeren_strukturert (4) 11.pdf

Screen Shot 2019-03-25 at 11 24 38 AM Screen Shot 2019-03-25 at 11 24 48 AM

Originally posted by @rakeshkasinathan in https://github.com/mozilla/pdf.js/issues/10672#issuecomment-476064327

THausherr commented 5 years ago

An ideal bug report contains three things: what you were doing, what you were expecting, and what happened instead.

What were you expecting?

Snuffleupagus commented 5 years ago

Please don't open multiple duplicate issues, but update the original one with all the necessary information instead and then that may be re-opened when enough information has been provided.

timvandermeij commented 5 years ago

I agree with the comments above: what are you expecting? From the screenshots I really can't tell what the problem is. Is there text in the annotations that should not be there? Should there be more/less annotations? What is the rendering defect you're reporting?

rakeshkasinathan commented 5 years ago

There are two issues:

  1. The comment in the insert mark (blue caret symbol) is not showing up in PDFjs. If you open the attached PDF in the Acrobat Reader, you would notice that both the insert icons have comments in them. These completely missing in PDFjs.

  2. In this sticky note comment at the start of the PDF, the original comment was "This is a test" and it has reply to comment "My reply". Only "My Reply" is showing up.

I have attached the PDF that I'm using to test for your reference.

Passasjeren_strukturert (4) 11.pdf

vlastimilmaca commented 5 years ago

Hi, there is missing implementation of some annotation features like InReplyTo (your 2. issue) and groups (your 1. issue).

This requires quite a lot of coding on both worker part and display part of pdfjs. I tried to implement the worker part, so I can provide that as merge request (https://github.com/vlastimilmaca/pdf.js/tree/annotations-enhanced-parsing), but there's gonna be some extensive coding work on display part too. I think, there will have to be some kind of side-bar (like bookmarks, attachments etc) for displaying markup annotations as discussion threads. In page area, on mouseover, there should be displayed first comment + info about how many replies and states it has (which will probably need some localized text ... not easy ...). On click, it should open discussion sidebar and focus to correct annotation thread. But that is how I see it and it will be quite a lot of work to get it done right. But worker part is probably first step ... It should not break display part, so display part work can start later.

To reply to your issues:

  1. That annotation's content is defined in another annotation, which belongs to same group as master annotation. Master annotation should inherit some properties from it's child annotations Master annotation provide properties for child annotations and child annotations should inherit them from master, but this is not implemented yet.

  2. Now, when annotation has a reply, it is rendered into page as any other annotation and because it has same size and location, it hides it's parent, so only last reply is visible (but others are beneath).

rakeshkasinathan commented 5 years ago

Do you need any more clarifications from my side.

rakeshkasinathan commented 5 years ago

I understand that the above solution of for enhancing annotations with multiple response to a comments. We still have another outstanding issue. The insert comment with the blue caret symbol still does not display the comment it. How can we get to see the comment inside the insert comment in PDFjs.

Screen Shot 2019-04-05 at 3 45 26 PM
vlastimilmaca commented 5 years ago

That should do the implementation of worker part I guess … It should correctly fill-in the master annotation with content and current display layer should display it just fine. I'll try to prepare merge request over weekend and we will se where we can get :).

Edit: So I looked into this again and it is little different then what I thought (sorry for that, it's been more than 2 months since I worked on this).

Worker thread will correctly fill child annotations, but child annotations should probably use master annotation's popup, so there will be need to make changes in viewer part or make some more changes in worker part. More in pull request.

a7vickey commented 5 years ago

Hello,

How can i get CaretAnnotation,StrikeOutAnnotation position and text ranges.

55620969-e4297800-57b9-11e9-9ad0-bb40c3ce2427

THausherr commented 5 years ago

For caret, use the /Rectangle entry. For strikeout, use the /QuadPoints entry. See also the PDF specification. https://www.adobe.com/content/dam/acom/en/devnet/pdf/pdfs/PDF32000_2008.pdf however the order of the quadpoints is wrong, see https://stackoverflow.com/questions/9855814/pdf-spec-vs-acrobat-creation-quadpoints

timvandermeij commented 5 years ago

The functionality is now in the API, so since the other points here are fixed I'm closing this with #10982 as a follow-up.