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 break when upgrading from old version of PDF.js #14756

Closed
chinaowl opened this issue Apr 6, 2022 · 1 comment
Closed

Annotations break when upgrading from old version of PDF.js #14756

chinaowl opened this issue Apr 6, 2022 · 1 comment

Comments

@chinaowl
Copy link

chinaowl commented Apr 6, 2022

We are trying to upgrade PDF.js from 1.8.514 to 2.10.377. However, we are running into an issue with annotations where annotations that were saved in a PDF while using an older version do not show up when viewing the PDF using the newer version.

For example, an old annotation was saved at this location: /div[1]/div[3]/div[2]/div[37]. After upgrading PDF.js, the annotation no longer appears. When saving a new annotation at the same spot, I can see that the location is now /div[1]/div[3]/div[2]/span[44]. Could this have to do with this (very old) change?

I'm wondering if there's a reliable way to translate these old annotations so that they work with the newer versions of PDF.js. (I tried changing the last div to a span and adding 7, but alas that only worked for a handful of annotations.)


Attach (recommended) or Link to PDF file here:

Configuration:

  • Web browser and its version: Chrome 100.0.4896.60
  • Operating system and its version: macOS 12.3
  • PDF.js version: 1.8.514 and 2.10.377
  • Is a browser extension: no

Steps to reproduce the problem:

  1. Create an annotation using an old version of PDF.js and this library (which is also very old)
  2. Upgrade PDF.js and attempt to view the same PDF plus annotations

What is the expected behavior? (add screenshot)

The annotation appears in the right spot.

What went wrong? (add screenshot)

The annotation does not appear at all.

Link to a viewer (if hosted on a site other than mozilla.github.io/pdf.js or as Firefox/Chrome extension):

@Snuffleupagus
Copy link
Collaborator

We are trying to upgrade PDF.js from 1.8.514 to 2.10.377.

Please note that neither of those versions are supported any more, please find the latest releases at https://mozilla.github.io/pdf.js/getting_started/#download
Furthermore, note that it's generally very difficult to provide any assistance with updates from such "ancient" version of the PDF.js library since there's literally been thousands of changes since then.

For example, an old annotation was saved at this location: /div[1]/div[3]/div[2]/div[37]. After upgrading PDF.js, the annotation no longer appears. When saving a new annotation at the same spot, I can see that the location is now /div[1]/div[3]/div[2]/span[44]. Could this have to do with this (very old) change?

Unfortunately it's simply impossible to help here, since we cannot even reproduce the problem you're describing.
However, it does sound like you were perhaps doing something that we've never officially supported, and note that the exact format/contents of the textLayer has changed a lot with recent improvements.

Also, the Attach (recommended) or Link to PDF file here:-part of the ISSUE_TEMPLATE is missing, and please note https://github.com/mozilla/pdf.js/blob/master/.github/CONTRIBUTING.md (emphasis mine):

If you are developing a custom solution, first check the examples at https://github.com/mozilla/pdf.js#learning and search existing issues. If this does not help, please prepare a short well-documented example that demonstrates the problem and make it accessible online on your website, JS Bin, GitHub, etc. before opening a new issue or contacting us in the Matrix room -- keep in mind that just code snippets won't help us troubleshoot the problem.


Create an annotation using an old version of PDF.js and this library (which is also very old)

Please note that we unfortunately can't provide any help/support other projects here (and that one also looks completely unmaintained).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants