-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Improve the viewer layer documentation #12764
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
Comments
Generally speaking: Please note that the lack of proper documentation for the default viewer is somewhat on purpose, given http://mozilla.github.io/pdf.js/getting_started/#introduction (emphasis mine):
|
Yeah, It clearly advises to re-skin it or build upon it but don't give enough materials on how. |
So are you saying that viewer.js should not be used? |
It's difficult to re-skin it as there are no docs available on how to customise its skin |
I am trying to re-skin it to hide some button in toolbar with editing viewer.html file and viewer.css file. when I saw this instruction on Github
I thought there is documentation for re-skin it or build upon it, as they say it as if it's easy to re-skin or build upon it, but there isn't. |
Considering that the default viewer is written specifically to be used as the built-in PDF Viewer in Firefox, general re-use has never been a priority and we thus need to be able to make backwards incompatible changes where that makes sense for the Firefox use-case. (The viewer components, see https://github.com/mozilla/pdf.js/tree/master/examples/components, on the other hand should not break in backwards incompatible ways when updating.) Hence we cannot guarantee that updating the default viewer will always work, however making e.g. CSS-only changes should reduce the risk of breakage when updating. Another good idea is to update frequently, and not wait e.g. a year before doing so, since that should also limit the number of changes that you need to deal with. Please keep in mind that the versioning in this library is based on the API (see https://github.com/mozilla/pdf.js/blob/master/src/display/api.js) and also on the viewer components (see https://github.com/mozilla/pdf.js/blob/master/web/pdf_viewer.component.js), however the default viewer is not included in the versioning.
Please note the following Line 134 in 41dab8e
Lines 876 to 885 in 41dab8e
It's unclear exactly what "options" that's referred to here, and if it's the API or the default viewer that's relevant. Lines 126 to 218 in 41dab8e
For the default viewer, options can be set using either the Preferences and/or the AppOptions, please see https://github.com/mozilla/pdf.js/blob/master/web/preferences.js and https://github.com/mozilla/pdf.js/blob/master/web/app_options.js Possibly https://github.com/mozilla/pdf.js/wiki/Third-party-viewer-usage is also helpful here.
Please see PR #14112, which is available in the latest release; see https://mozilla.github.io/pdf.js/getting_started/#download. |
It would be straightforward to get started from the upper layer that is the viewer. Unfortunately, every tutorials and examples show basic display functionalities such as how to render a page in a canvas, how to add previous and next button, etc.
https://github.com/mozilla/pdf.js/wiki/Viewer-options is the only available resource on the viewer. There is no indication on how to customize it, like:
The text was updated successfully, but these errors were encountered: