lfoppiano / streamlit-pdf-viewer

Streamlit PDF viewer
https://structure-vision.streamlit.app/
Apache License 2.0
62 stars 3 forks source link

Update pdf.js to version 4 #36

Closed lfoppiano closed 1 week ago

lfoppiano commented 4 months ago
PDF.js 4.0 is a major release that contains a number of API changes, features and bugfixes. The following changes are highlighted:

    Conversion to JavaScript modules for the builds
    Conversion to Fluent for localization
    Optimizations for CPU and memory usage
    Improvements and bugfixes for the annotation editor and annotation rendering
    Removal of the deprecated SVG back-end
    Removal of other deprecated functionality and options
lfoppiano commented 1 month ago

One of the limitation of this release is that node should be >= 18.

lfoppiano commented 1 month ago

https://github.com/lfoppiano/streamlit-pdf-viewer/security/dependabot/1

t29mato commented 1 month ago
image

https://github.com/lfoppiano/streamlit-pdf-viewer/commit/5f09846fbc5b4cd71ab910f98b343d681e5808ed

I've modified the method for loading pdfjs-dist and fixed transpilation settings. With these changes, the text is now displayed on top of the PDF in my environment as shown in the attached file. The position is still misaligned, though. 🤔

Since I have updated several library versions, you will need to delete node_modules and package-lock.json once to run in your environment.

lfoppiano commented 1 month ago

Thanks great! Thanks!