React-pdf: Adding toolbar to pdf.js

Created on 16 Oct 2019  路  2Comments  路  Source: wojtekmaj/react-pdf

Before you start - checklist

  • [x] I have read documentation in README
  • [x] I have checked sample and test suites to see real life basic implementation
  • [x] I have checked if this question is not already asked

What are you trying to achieve? Please describe.
I am trying to display the toolbar from pdf.js

Describe what are you trying to achieve Ex. I'd like to display multiple pages of my PDF.
I would like the toolbar, with all of the pdf options to display when the pdf does.

Describe solutions you've tried
I have tried to manually get the pdf by using methods from pdf.js, like 'getDocument' and 'getPage'

Describe solutions you've already tried, if any. Make sure to include code samples if you're stuck on implementation.
I could create my own toolbar, but if pdf.js has their own that is already hooked that would save me a lot of time.

Additional information

If applicable, add screenshots (preferably with browser console open) and files you have an issue with to help explain your problem.

Environment

  • Browser (if applicable) [e.g. Chrome 57, Firefox 59]: Chrome 77
  • React-PDF version [e.g. 3.0.4]: 4.1.0
  • React version [e.g. 16.3.0]: 16.8.6
  • Webpack version (if applicable) [e.g. 4.16.2]: Create-react-app
question

Most helpful comment

I'm posting this here for future readers, since leaving this out made no sense to me and I wasted a lot of time trying to find a simple solution.

Apparently Mozilla doesn't want you to use their viewer whole cloth. They say so on their Getting Started page:

The viewer is built on the display layer and is the UI for PDF viewer in Firefox and the other browser extensions within the project. It can be a good starting point for building your own viewer. However, we do ask if you plan to embed the viewer in your own site, that it not just be an unmodified version. Please re-skin it or build upon it.

I think that's why a package such as react-pdf couldn't / shouldn't include Mozilla's viewer as is. It seems like a really good opportunity for someone to make a new pdf viewer package, or to add that functionality to this one.

All 2 comments

React-PDF in no way tries to re-implement pdf.js _viewer_. It's just a way of displaying PDFs in canvas/svg. It might be used to build the solution you're looking for, but it _isn't the_ solution.

I'm posting this here for future readers, since leaving this out made no sense to me and I wasted a lot of time trying to find a simple solution.

Apparently Mozilla doesn't want you to use their viewer whole cloth. They say so on their Getting Started page:

The viewer is built on the display layer and is the UI for PDF viewer in Firefox and the other browser extensions within the project. It can be a good starting point for building your own viewer. However, we do ask if you plan to embed the viewer in your own site, that it not just be an unmodified version. Please re-skin it or build upon it.

I think that's why a package such as react-pdf couldn't / shouldn't include Mozilla's viewer as is. It seems like a really good opportunity for someone to make a new pdf viewer package, or to add that functionality to this one.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

herneli picture herneli  路  3Comments

saadq picture saadq  路  3Comments

webguru103 picture webguru103  路  3Comments

lorenzos picture lorenzos  路  5Comments

GManzato picture GManzato  路  4Comments