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

Annotations don't get displayed correctly #1937

Closed
PatrickZimmerer opened this issue Nov 6, 2023 · 10 comments
Closed

Annotations don't get displayed correctly #1937

PatrickZimmerer opened this issue Nov 6, 2023 · 10 comments
Assignees
Labels
bug Something isn't working Please send me a reproducer A reproducer is a minimal but working project showing the problem.

Comments

@PatrickZimmerer
Copy link

I am using version 18.1.4

When fetching Annotations some of them are not displayed on the PDF, this error occurs when a PDF has multiple pages, for example, I had a PDF with 6 pages, and annotations get loaded and displayed correctly for pages 1 & 2, but for the rest of the pages, they don't get rendered, the annotations get loaded correctly from the database and are provided with the correct page index, I also tried the workaround from a past Issue #1825 (comment) but this doesn't work and should be fixed in 18.0.0-beta.4

@jfl-tel
Copy link

jfl-tel commented Nov 6, 2023

this is probably an issue with pdfjs directly not ngx-extended-pdf-viewer
I know I add somme issue with annotation and it was fix in v4.0.189
mozilla/pdf.js#17216

@PatrickZimmerer
Copy link
Author

So we are not using pdfJs in our project currently, only the ngx-extended-pdf-viewer which is using pdfJs under the hood is that correct?
Can I do something to fix this bug?

@jfl-tel
Copy link

jfl-tel commented Nov 7, 2023

yes it is correct, so you need to check if the bug is present in pdfjs latest
if not then it's fixed and you will need to wait for the next ngx-extended-pdf-viewer that will use (4.0.189)
When I found my bug, I open an Issue in pdfjs with a bugfix suggestion, and it was quickly fixed

@stephanrauh stephanrauh self-assigned this Nov 7, 2023
@stephanrauh
Copy link
Owner

@PatrickZimmerer Please fill in some details. I assume you're trying to programatically add annotations to a PDF file that has already been loaded by ngx-extended-pdf-viewer. If so, it'll be very difficult to reproduce the bug with pdf.js. I'd also need a reproducer, because I don't think I a reproduce your issue in my limited spare time.

On the other hand, if you've run into a problem with a PDF file that already has the annotations, please open your file in the showcase of pdf.js (https://mozilla.github.io/pdf.js/web/viewer.html#page=1&zoom=auto,-213,792). If you can reproduce the bug over there, please report it to the Mozilla team. Just make sure you don't mention my project. pdf.js is the PDF viewer of Firefox, so they tend to solve only bugs that also show in Firefox.

@stephanrauh
Copy link
Owner

@jfl-tel I'm afraid pdf.js 4.0 won't come soon. They've added a couple of breaking changes, and that sounds like a lot of work for me. The changelog doesn't read that dramatic, but you never know.

@stephanrauh stephanrauh added bug Something isn't working Please send me a reproducer A reproducer is a minimal but working project showing the problem. labels Nov 7, 2023
@jfl-tel
Copy link

jfl-tel commented Nov 7, 2023

@stephanrauh do you think before Christmas ?

@stephanrauh
Copy link
Owner

I've learned the hard way not to make promises... but , yes,I hope I'll be able to update to 4.0 before Christmas.

@PatrickZimmerer
Copy link
Author

@PatrickZimmerer Please fill in some details. I assume you're trying to programatically add annotations to a PDF file that has already been loaded by ngx-extended-pdf-viewer. If so, it'll be very difficult to reproduce the bug with pdf.js. I'd also need a reproducer, because I don't think I a reproduce your issue in my limited spare time.

On the other hand, if you've run into a problem with a PDF file that already has the annotations, please open your file in the showcase of pdf.js (https://mozilla.github.io/pdf.js/web/viewer.html#page=1&zoom=auto,-213,792). If you can reproduce the bug over there, please report it to the Mozilla team. Just make sure you don't mention my project. pdf.js is the PDF viewer of Firefox, so they tend to solve only bugs that also show in Firefox.

I'll look into creating a reproducer, the weird thing is that the annotations get loaded from the database correctly (with the needed pageIndex etc.) but adding those to the pdf with the addEditorAnntotation() and passing in the annotation as an argument works perfectly fine but just up until the second page, any annotations further down the pdf won't get added even though they have an pageIndex > 1

@stephanrauh
Copy link
Owner

Chances are you're adding the annotations too early. The PDF file is rendered lazily. Only the first few pages are shown immediately. Try adding the annotations when the event (annotationLayerRendered). This event is fired when the annotation layer of a page has been rendered. In other words, you'll receive it multiple times.

stephanrauh added a commit to stephanrauh/extended-pdf-viewer-showcase that referenced this issue Nov 8, 2023
…notationLayerRendered)` and `[showStampEditor]`
@stephanrauh
Copy link
Owner

I'm closing the ticket now because I haven't heard from your for two weeks. However, if you send me a reproducer, I'll have a look at it and re-open the ticket if necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Please send me a reproducer A reproducer is a minimal but working project showing the problem.
Projects
None yet
Development

No branches or pull requests

3 participants