Replace vendored pdf.js with webpack-loaded version #8621

Closed
opened 2025-11-02 08:12:38 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @silverwind on GitHub (Feb 26, 2022).

https://github.com/go-gitea/gitea/tree/main/public/vendor/plugins/pdfjs contains a outdated vendored copy of pdf.js. We should instead find a way to load pdf.js via webpack.

The main challenge will be that the "viewer" component (which is basically all the UI for pdf.js) is not part of the official pdf.js distribution, so we need some way to sideload it or some other similar UI, maybe https://github.com/hediet/pdf.js-viewer.

Originally created by @silverwind on GitHub (Feb 26, 2022). https://github.com/go-gitea/gitea/tree/main/public/vendor/plugins/pdfjs contains a outdated vendored copy of pdf.js. We should instead find a way to load pdf.js via webpack. The main challenge will be that the "viewer" component (which is basically all the UI for pdf.js) is not part of the official pdf.js distribution, so we need some way to sideload it or some other similar UI, maybe https://github.com/hediet/pdf.js-viewer.
GiteaMirror added the issue/confirmedtopic/ui labels 2025-11-02 08:12:38 -06:00
Author
Owner

@silverwind commented on GitHub (Feb 26, 2022):

Or maybe just replace it entirely with https://pdfobject.com/, which is a browser-native pdf viewer. Only issue is that it won't work on mobile at all, so we would display a download link instead then.

@silverwind commented on GitHub (Feb 26, 2022): Or maybe just replace it entirely with https://pdfobject.com/, which is a browser-native pdf viewer. Only issue is that it won't work on mobile at all, so we would display a download link instead then.
Author
Owner

@stale[bot] commented on GitHub (Apr 28, 2022):

This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.

@stale[bot] commented on GitHub (Apr 28, 2022): This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.
Author
Owner

@aceArt-GmbH commented on GitHub (Apr 11, 2023):

I created a PoC b8cee55f91 using pdfobject.
PDFs should work in latest firefox for android.

Opinions on the issue and the solution? (also technical)

image
before -> after

@aceArt-GmbH commented on GitHub (Apr 11, 2023): I created a PoC https://github.com/aceArt-GmbH/gitea/commit/b8cee55f91291076440ca0d986288af7f56bb865 using pdfobject. PDFs should work in latest [firefox for android](https://www.mozilla.org/en-US/firefox/android/111.0/releasenotes/#note-789422). Opinions on the issue and the solution? (also technical) ![image](https://user-images.githubusercontent.com/33117017/231153212-db93037a-efaf-4bcd-b73f-eebfecd5b371.png) before -> after
Author
Owner

@silverwind commented on GitHub (Apr 11, 2023):

I did not consider PDFObject so far because of lacking mobile support.

Also see https://github.com/go-gitea/gitea/issues/23994. I think what we should do is to have a viewer-less pdf.js rendering, similar to GitLab or GitHub.

@silverwind commented on GitHub (Apr 11, 2023): I did not consider PDFObject so far because of [lacking mobile support](https://pdfobject.com/#browser-support). Also see https://github.com/go-gitea/gitea/issues/23994. I think what we should do is to have a viewer-less pdf.js rendering, similar to GitLab or GitHub.
Author
Owner

@wxiaoguang commented on GitHub (Apr 4, 2025):

It seems to have been done by Add PDF rendering via PDFObject #24086

@wxiaoguang commented on GitHub (Apr 4, 2025): It seems to have been done by Add PDF rendering via PDFObject #24086
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#8621