pdf.js needs to be built with webpack #10612

Closed
opened 2025-11-02 09:12:41 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @silverwind on GitHub (Apr 8, 2023).

Feature Description

There is a outdated copy of pdf.js with its viewer that is used to render PDFs which we should run through webpack to get a contenthash.

Maybe there are also more modern solutions for PDF rendering that don't require us to ship pdf.js at all.

Alternatively, we could also implement a viewer-less view like GitHub did. Last I checked, Mozilla did not like it when other software embeds their viewer. GL pdf renderer for reference. pdf.js webpack example.

Originally created by @silverwind on GitHub (Apr 8, 2023). ### Feature Description There is a outdated [copy of pdf.js](https://github.com/go-gitea/gitea/tree/main/public/vendor/plugins/pdfjs) with its viewer that is used to render PDFs which we should run through webpack to get a [contenthash](https://github.com/go-gitea/gitea/issues/23952). Maybe there are also more modern solutions for PDF rendering that don't require us to ship pdf.js at all. Alternatively, we could also implement a viewer-less view like GitHub did. Last I checked, Mozilla did not like it when other software embeds their viewer. [GL pdf renderer](https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/assets/javascripts/pdf/index.vue) for reference. [pdf.js webpack example](https://github.com/mozilla/pdf.js/tree/master/examples/webpack).
GiteaMirror added the type/enhancementtype/proposal labels 2025-11-02 09:12:41 -06:00
Author
Owner

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

I think going viewerless is the way to go. Neither GitLab nor GitHub provide controls for their PDF rendering, and I think these controls are mostly unecessary. User can just open the file raw to get their browser to render it (likely with controls).

@silverwind commented on GitHub (Apr 8, 2023): I think going viewerless is the way to go. Neither [GitLab](https://gitlab.com/gitlab-com/www-gitlab-com/-/blob/master/source/images/press/logo/print/pdf/gitlab-logo-150.pdf) nor [GitHub](https://github.com/silverwind/symlink-test/blob/master/test.pdf) provide controls for their PDF rendering, and I think these controls are mostly unecessary. User can just open the file raw to get their browser to render it (likely with controls).
Author
Owner

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

Actually duplicate with https://github.com/go-gitea/gitea/issues/18912.

@silverwind commented on GitHub (Apr 11, 2023): Actually duplicate with https://github.com/go-gitea/gitea/issues/18912.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#10612