2013-11-23 04:10:43 +09:00
<!DOCTYPE html>
2012-09-01 07:48:21 +09:00
<!--
Copyright 2012 Mozilla Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
2014-03-11 05:03:35 +09:00
2015-06-30 16:33:25 +09:00
Adobe CMap resources are covered by their own copyright but the same license:
Copyright 1990-2015 Adobe Systems Incorporated.
See https://github.com/adobe-type-tools/cmap-resources
2012-09-01 07:48:21 +09:00
-->
2018-01-20 06:05:50 +09:00
< html dir = "ltr" mozdisallowselectionprint >
2012-04-12 08:12:51 +09:00
< head >
2012-05-01 11:55:21 +09:00
< meta charset = "utf-8" >
2012-05-24 06:50:54 +09:00
< meta name = "viewport" content = "width=device-width, initial-scale=1, maximum-scale=1" >
2013-07-16 07:13:05 +09:00
<!-- #if GENERIC || CHROME -->
< meta name = "google" content = "notranslate" >
<!-- #endif -->
2012-04-19 04:02:49 +09:00
< title > PDF.js viewer< / title >
2012-08-02 03:29:13 +09:00
2020-01-08 21:57:31 +09:00
<!-- #if MOZCENTRAL -->
2012-08-02 03:29:13 +09:00
<!-- #include viewer - snippet - firefox - extension.html -->
[CRX] Show nicely formatted URL in omnibox
Before commit:
chrome-extension://EXTENSIONID/content/web/viewer.html?file=http%3A%2F%2Fexample.com%2Ffile.pdf
After commit:
chrome-extension://EXTENSIONID/http://example/file.pdf
Technical details:
- The extension's background page uses the webRequest API to intercept
requests for <extension host>/<real path to pdf>, and redirect it to
the viewer's URL.
- viewer.js uses history.replaceState to rewrite the URL, so that it's
easier for users to recognize and copy-paste URLs.
- The fake paths /http:, /https:, /file:, etc. have been added to the
web_accessible_resources section of the manifest file, in order to
avoid seeing chrome-extension://invalid/ instead of the actual URL
when using history back/forward to navigate from/to the PDF viewer.
- Since the relative path resolving doesn't work because relative URLs
are inaccurate, a <base> tag has been added. This method has already
been proven to work in the Firefox add-on.
Notes:
- This commit has been cherry-picked from crx-using-streams-api.
- Need to merge https://github.com/mozilla/pdf.js/pull/3582 to deal with
a bug in Chrome <=30
- In Chrome, getting the contents of a FTP file is not possible, so
there's no support for FTP files, even though the extension router
recognizes the ftp: scheme.
2013-08-16 05:47:30 +09:00
<!-- #endif -->
<!-- #if CHROME -->
<!-- #include viewer - snippet - chrome - extension.html -->
2012-08-02 03:29:13 +09:00
<!-- #endif -->
2012-04-12 08:12:51 +09:00
2016-02-14 21:23:34 +09:00
< link rel = "stylesheet" href = "viewer.css" >
2012-08-02 03:29:13 +09:00
<!-- #if !PRODUCTION -->
2016-02-14 21:23:34 +09:00
< link rel = "resource" type = "application/l10n" href = "locale/locale.properties" >
2012-08-02 03:29:13 +09:00
<!-- #endif -->
<!-- #if !PRODUCTION -->
2020-05-20 01:00:23 +09:00
< script defer src = "../node_modules/es-module-shims/dist/es-module-shims.js" > < / script >
< script type = "importmap-shim" >
{
"imports": {
"pdfjs/": "../src/",
"pdfjs-lib": "../src/pdf.js",
2022-07-07 06:02:53 +09:00
"pdfjs-web/": "./",
"pdfjs-fitCurve": "../build/dev-fitCurve/fit_curve.js"
2020-05-20 01:00:23 +09:00
}
}
< / script >
< script src = "viewer.js" type = "module-shim" > < / script >
2012-08-02 03:29:13 +09:00
<!-- #endif -->
2014-01-18 01:50:54 +09:00
<!-- #if (GENERIC && !MINIFIED) -->
2012-08-02 03:29:13 +09:00
<!-- #include viewer - snippet.html -->
<!-- #endif -->
2014-01-18 01:50:54 +09:00
<!-- #if !MINIFIED -->
2020-05-20 01:00:23 +09:00
<!-- <script src="viewer.js"></script> -->
2014-01-18 01:50:54 +09:00
<!-- #else -->
<!-- #include viewer - snippet - minified.html -->
<!-- #endif -->
2013-06-19 01:05:55 +09:00
2012-04-12 08:12:51 +09:00
< / head >
2011-05-26 23:02:52 +09:00
Let the loadingBar have the same width as the viewerContainer
For years the loadingBar and sidebarContainer has had a slightly annoying and unfortunate dependency, since the loadingBar width follows the main toolbar width[1].
To prevent the loadingBar from obscuring part of the sidebarContainer, especially the buttons, the sidebarContainer is thus moved down when the loadingBar is visible. This has always annoyed me[2], since it means that the buttons in the sidebar may thus move vertically which seems bad from a UX perspective.
Now that CSS variables are available in all supported browsers[3] however, fixing the loadingBar/sidebarContainer overlap issues are finally easy. The solution is simply to let the sidebarContainer, when visible, control the loadingBar left position (right in RTL locales) in the same way that the viewerContainer is handled. Hence the sidebarContainer can now have a *consistent* vertical postition, without the loadingBar overlapping it.
---
[1] Obviously the right position (left in RTL locales) of the loadingBar is, potentially, reduced to account for a scrollbar.
[2] I've tried to fix this a few times, but it always seemed like more trouble than it's worth.
[3] https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties#Browser_compatibility
2020-09-08 21:13:10 +09:00
< body tabindex = "1" >
2014-08-17 07:22:05 +09:00
< div id = "outerContainer" >
2011-07-29 02:48:05 +09:00
2012-04-26 05:46:17 +09:00
< div id = "sidebarContainer" >
2012-10-30 06:35:07 +09:00
< div id = "toolbarSidebar" >
Add support for finding/highlighting the outlineItem, corresponding to the currently visible page, in the sidebar (issue 7557, bug 1253820, bug 1499050)
This implementation is inspired by the behaviour in (recent versions of) Adobe Reader, since it leads to reasonably simple and straightforward code as far as I'm concerned.
*Specifically:* We'll only consider *one* destination per page when finding/highlighting the current outline item, which is similar to e.g. Adobe Reader, and we choose the *first* outline item at the *lowest* level of the outline tree.
Given that this functionality requires not only parsing of the `outline`, but looking up *all* of the destinations in the document, this feature can when initialized have a non-trivial performance overhead for larger PDF documents.
In an attempt to reduce the performance impact, the following steps are taken here:
- The "find current outline item"-functionality will only be enabled once *one* page has rendered and *all* the pages have been loaded[1], to prevent it interfering with data regular fetching/parsing early on during document loading and viewer initialization.
- With the exception of a couple of small and simple `eventBus`-listeners, in `PDFOutlineViewer`, this new functionality is initialized *lazily* the first time that the user clicks on the `currentOutlineItem`-button.
- The entire "find current outline item"-functionality is disabled when `disableAutoFetch = true` is set, since it can easily lead to the setting becoming essentially pointless[2] by triggering *a lot* of data fetching from a relatively minor viewer-feature.
- Fetch the destinations *individually*, since that's generally more efficient than using `PDFDocumentProxy.getDestinations` to fetch them all at once. Despite making the overall parsing code *more* asynchronous, and leading to a lot more main/worker-thread message passing, in practice this seems faster for larger documents.
Finally, we'll now always highlight an outline item that the user manually clicked on, since only highlighting when the new "find current outline item"-functionality is used seemed inconsistent.
---
[1] Keep in mind that the `outline` itself already isn't fetched/parsed until at least *one* page has been rendered in the viewer.
[2] And also quite slow, since it can take a fair amount of time to fetch all of the necessary `destinations` data when `disableAutoFetch = true` is set.
2020-12-25 20:57:43 +09:00
< div id = "toolbarSidebarLeft" >
2022-02-11 22:04:47 +09:00
< div id = "sidebarViewButtons" class = "splitToolbarButton toggled" role = "radiogroup" >
< button id = "viewThumbnail" class = "toolbarButton toggled" title = "Show Thumbnails" tabindex = "2" data-l10n-id = "thumbs" role = "radio" aria-checked = "true" aria-controls = "thumbnailView" >
Add support for finding/highlighting the outlineItem, corresponding to the currently visible page, in the sidebar (issue 7557, bug 1253820, bug 1499050)
This implementation is inspired by the behaviour in (recent versions of) Adobe Reader, since it leads to reasonably simple and straightforward code as far as I'm concerned.
*Specifically:* We'll only consider *one* destination per page when finding/highlighting the current outline item, which is similar to e.g. Adobe Reader, and we choose the *first* outline item at the *lowest* level of the outline tree.
Given that this functionality requires not only parsing of the `outline`, but looking up *all* of the destinations in the document, this feature can when initialized have a non-trivial performance overhead for larger PDF documents.
In an attempt to reduce the performance impact, the following steps are taken here:
- The "find current outline item"-functionality will only be enabled once *one* page has rendered and *all* the pages have been loaded[1], to prevent it interfering with data regular fetching/parsing early on during document loading and viewer initialization.
- With the exception of a couple of small and simple `eventBus`-listeners, in `PDFOutlineViewer`, this new functionality is initialized *lazily* the first time that the user clicks on the `currentOutlineItem`-button.
- The entire "find current outline item"-functionality is disabled when `disableAutoFetch = true` is set, since it can easily lead to the setting becoming essentially pointless[2] by triggering *a lot* of data fetching from a relatively minor viewer-feature.
- Fetch the destinations *individually*, since that's generally more efficient than using `PDFDocumentProxy.getDestinations` to fetch them all at once. Despite making the overall parsing code *more* asynchronous, and leading to a lot more main/worker-thread message passing, in practice this seems faster for larger documents.
Finally, we'll now always highlight an outline item that the user manually clicked on, since only highlighting when the new "find current outline item"-functionality is used seemed inconsistent.
---
[1] Keep in mind that the `outline` itself already isn't fetched/parsed until at least *one* page has been rendered in the viewer.
[2] And also quite slow, since it can take a fair amount of time to fetch all of the necessary `destinations` data when `disableAutoFetch = true` is set.
2020-12-25 20:57:43 +09:00
< span data-l10n-id = "thumbs_label" > Thumbnails< / span >
< / button >
2022-02-11 22:04:47 +09:00
< button id = "viewOutline" class = "toolbarButton" title = "Show Document Outline (double-click to expand/collapse all items)" tabindex = "3" data-l10n-id = "document_outline" role = "radio" aria-checked = "false" aria-controls = "outlineView" >
Add support for finding/highlighting the outlineItem, corresponding to the currently visible page, in the sidebar (issue 7557, bug 1253820, bug 1499050)
This implementation is inspired by the behaviour in (recent versions of) Adobe Reader, since it leads to reasonably simple and straightforward code as far as I'm concerned.
*Specifically:* We'll only consider *one* destination per page when finding/highlighting the current outline item, which is similar to e.g. Adobe Reader, and we choose the *first* outline item at the *lowest* level of the outline tree.
Given that this functionality requires not only parsing of the `outline`, but looking up *all* of the destinations in the document, this feature can when initialized have a non-trivial performance overhead for larger PDF documents.
In an attempt to reduce the performance impact, the following steps are taken here:
- The "find current outline item"-functionality will only be enabled once *one* page has rendered and *all* the pages have been loaded[1], to prevent it interfering with data regular fetching/parsing early on during document loading and viewer initialization.
- With the exception of a couple of small and simple `eventBus`-listeners, in `PDFOutlineViewer`, this new functionality is initialized *lazily* the first time that the user clicks on the `currentOutlineItem`-button.
- The entire "find current outline item"-functionality is disabled when `disableAutoFetch = true` is set, since it can easily lead to the setting becoming essentially pointless[2] by triggering *a lot* of data fetching from a relatively minor viewer-feature.
- Fetch the destinations *individually*, since that's generally more efficient than using `PDFDocumentProxy.getDestinations` to fetch them all at once. Despite making the overall parsing code *more* asynchronous, and leading to a lot more main/worker-thread message passing, in practice this seems faster for larger documents.
Finally, we'll now always highlight an outline item that the user manually clicked on, since only highlighting when the new "find current outline item"-functionality is used seemed inconsistent.
---
[1] Keep in mind that the `outline` itself already isn't fetched/parsed until at least *one* page has been rendered in the viewer.
[2] And also quite slow, since it can take a fair amount of time to fetch all of the necessary `destinations` data when `disableAutoFetch = true` is set.
2020-12-25 20:57:43 +09:00
< span data-l10n-id = "document_outline_label" > Document Outline< / span >
< / button >
2022-02-11 22:04:47 +09:00
< button id = "viewAttachments" class = "toolbarButton" title = "Show Attachments" tabindex = "4" data-l10n-id = "attachments" role = "radio" aria-checked = "false" aria-controls = "attachmentsView" >
Add support for finding/highlighting the outlineItem, corresponding to the currently visible page, in the sidebar (issue 7557, bug 1253820, bug 1499050)
This implementation is inspired by the behaviour in (recent versions of) Adobe Reader, since it leads to reasonably simple and straightforward code as far as I'm concerned.
*Specifically:* We'll only consider *one* destination per page when finding/highlighting the current outline item, which is similar to e.g. Adobe Reader, and we choose the *first* outline item at the *lowest* level of the outline tree.
Given that this functionality requires not only parsing of the `outline`, but looking up *all* of the destinations in the document, this feature can when initialized have a non-trivial performance overhead for larger PDF documents.
In an attempt to reduce the performance impact, the following steps are taken here:
- The "find current outline item"-functionality will only be enabled once *one* page has rendered and *all* the pages have been loaded[1], to prevent it interfering with data regular fetching/parsing early on during document loading and viewer initialization.
- With the exception of a couple of small and simple `eventBus`-listeners, in `PDFOutlineViewer`, this new functionality is initialized *lazily* the first time that the user clicks on the `currentOutlineItem`-button.
- The entire "find current outline item"-functionality is disabled when `disableAutoFetch = true` is set, since it can easily lead to the setting becoming essentially pointless[2] by triggering *a lot* of data fetching from a relatively minor viewer-feature.
- Fetch the destinations *individually*, since that's generally more efficient than using `PDFDocumentProxy.getDestinations` to fetch them all at once. Despite making the overall parsing code *more* asynchronous, and leading to a lot more main/worker-thread message passing, in practice this seems faster for larger documents.
Finally, we'll now always highlight an outline item that the user manually clicked on, since only highlighting when the new "find current outline item"-functionality is used seemed inconsistent.
---
[1] Keep in mind that the `outline` itself already isn't fetched/parsed until at least *one* page has been rendered in the viewer.
[2] And also quite slow, since it can take a fair amount of time to fetch all of the necessary `destinations` data when `disableAutoFetch = true` is set.
2020-12-25 20:57:43 +09:00
< span data-l10n-id = "attachments_label" > Attachments< / span >
< / button >
2022-02-11 22:04:47 +09:00
< button id = "viewLayers" class = "toolbarButton" title = "Show Layers (double-click to reset all layers to the default state)" tabindex = "5" data-l10n-id = "layers" role = "radio" aria-checked = "false" aria-controls = "layersView" >
Add support for finding/highlighting the outlineItem, corresponding to the currently visible page, in the sidebar (issue 7557, bug 1253820, bug 1499050)
This implementation is inspired by the behaviour in (recent versions of) Adobe Reader, since it leads to reasonably simple and straightforward code as far as I'm concerned.
*Specifically:* We'll only consider *one* destination per page when finding/highlighting the current outline item, which is similar to e.g. Adobe Reader, and we choose the *first* outline item at the *lowest* level of the outline tree.
Given that this functionality requires not only parsing of the `outline`, but looking up *all* of the destinations in the document, this feature can when initialized have a non-trivial performance overhead for larger PDF documents.
In an attempt to reduce the performance impact, the following steps are taken here:
- The "find current outline item"-functionality will only be enabled once *one* page has rendered and *all* the pages have been loaded[1], to prevent it interfering with data regular fetching/parsing early on during document loading and viewer initialization.
- With the exception of a couple of small and simple `eventBus`-listeners, in `PDFOutlineViewer`, this new functionality is initialized *lazily* the first time that the user clicks on the `currentOutlineItem`-button.
- The entire "find current outline item"-functionality is disabled when `disableAutoFetch = true` is set, since it can easily lead to the setting becoming essentially pointless[2] by triggering *a lot* of data fetching from a relatively minor viewer-feature.
- Fetch the destinations *individually*, since that's generally more efficient than using `PDFDocumentProxy.getDestinations` to fetch them all at once. Despite making the overall parsing code *more* asynchronous, and leading to a lot more main/worker-thread message passing, in practice this seems faster for larger documents.
Finally, we'll now always highlight an outline item that the user manually clicked on, since only highlighting when the new "find current outline item"-functionality is used seemed inconsistent.
---
[1] Keep in mind that the `outline` itself already isn't fetched/parsed until at least *one* page has been rendered in the viewer.
[2] And also quite slow, since it can take a fair amount of time to fetch all of the necessary `destinations` data when `disableAutoFetch = true` is set.
2020-12-25 20:57:43 +09:00
< span data-l10n-id = "layers_label" > Layers< / span >
< / button >
< / div >
< / div >
< div id = "toolbarSidebarRight" >
< div id = "outlineOptionsContainer" class = "hidden" >
< div class = "verticalToolbarSeparator" > < / div >
< button id = "currentOutlineItem" class = "toolbarButton" disabled = "disabled" title = "Find Current Outline Item" tabindex = "6" data-l10n-id = "current_outline_item" >
< span data-l10n-id = "current_outline_item_label" > Current Outline Item< / span >
< / button >
< / div >
2012-10-30 06:35:07 +09:00
< / div >
2011-07-29 02:48:05 +09:00
< / div >
2012-04-26 03:34:28 +09:00
< div id = "sidebarContent" >
< div id = "thumbnailView" >
2012-04-12 08:12:51 +09:00
< / div >
2012-04-26 03:34:28 +09:00
< div id = "outlineView" class = "hidden" >
2012-04-12 08:12:51 +09:00
< / div >
2014-03-19 05:32:47 +09:00
< div id = "attachmentsView" class = "hidden" >
< / div >
[api-minor] Add support for toggling of Optional Content in the viewer (issue 12096)
*Besides, obviously, adding viewer support:* This patch attempts to improve the general API for Optional Content Groups slightly, by adding a couple of new methods for interacting with the (more complex) data structures of `OptionalContentConfig`-instances. (Thus allowing us to mark some of the data as "private", given that it probably shouldn't be manipulated directly.)
By utilizing not just the "raw" Optional Content Groups, but the data from the `/Order` array when available, we can thus display the Layers in a proper tree-structure with collapsible headings for PDF documents that utilizes that feature.
Note that it's possible to reset all Optional Content Groups to their default visibility state, simply by double-clicking on the Layers-button in the sidebar.
(Currently that's indicated in the Layers-button tooltip, which is obviously easy to overlook, however it's probably the best we can do for now without adding more buttons, or even a dropdown-toolbar, to the sidebar.)
Also, the current Layers-button icons are a little rough around the edges, quite literally, but given that the viewer will soon have its UI modernized anyway they hopefully suffice in the meantime.
To give users *full* control of the visibility of the various Optional Content Groups, even those which according to the `/Order` array should not (by default) be toggleable in the UI, this patch will place those under a *custom* heading which:
- Is collapsed by default, and placed at the bottom of the Layers-tree, to be a bit less obtrusive.
- Uses a slightly different formatting, compared to the "regular" headings.
- Is localizable.
Finally, note that the thumbnails are *purposely* always rendered with all Optional Content Groups at their default visibility state, since that seems the most useful and it's also consistent with other viewers.
To ensure that this works as intended, we'll thus disable the `PDFThumbnailView.setImage` functionality when the Optional Content Groups have been changed in the viewer. (This obviously means that we'll re-render thumbnails instead of using the rendered pages. However, this situation ought to be rare enough for this to not really be a problem.)
2020-08-07 04:01:03 +09:00
< div id = "layersView" class = "hidden" >
< / div >
2011-08-22 11:05:10 +09:00
< / div >
2020-09-09 20:29:44 +09:00
< div id = "sidebarResizer" > < / div >
2012-04-26 03:34:28 +09:00
< / div > <!-- sidebarContainer -->
< div id = "mainContainer" >
2017-03-09 07:54:28 +09:00
< div class = "findbar hidden doorHanger" id = "findbar" >
< div id = "findbarInputContainer" >
2022-04-01 06:12:56 +09:00
< input id = "findInput" class = "toolbarField" title = "Find" placeholder = "Find in document…" tabindex = "91" data-l10n-id = "find_input" aria-invalid = "false" >
2017-03-09 07:54:28 +09:00
< div class = "splitToolbarButton" >
2022-04-19 20:43:24 +09:00
< button id = "findPrevious" class = "toolbarButton" title = "Find the previous occurrence of the phrase" tabindex = "92" data-l10n-id = "find_previous" >
2017-03-09 07:54:28 +09:00
< span data-l10n-id = "find_previous_label" > Previous< / span >
< / button >
< div class = "splitToolbarButtonSeparator" > < / div >
2022-04-19 20:43:24 +09:00
< button id = "findNext" class = "toolbarButton" title = "Find the next occurrence of the phrase" tabindex = "93" data-l10n-id = "find_next" >
2017-03-09 07:54:28 +09:00
< span data-l10n-id = "find_next_label" > Next< / span >
< / button >
< / div >
< / div >
2018-09-01 08:28:19 +09:00
< div id = "findbarOptionsOneContainer" >
2017-03-09 07:54:28 +09:00
< input type = "checkbox" id = "findHighlightAll" class = "toolbarField" tabindex = "94" >
2022-02-05 19:10:53 +09:00
< label for = "findHighlightAll" class = "toolbarLabel" data-l10n-id = "find_highlight" > Highlight All< / label >
2017-03-09 07:54:28 +09:00
< input type = "checkbox" id = "findMatchCase" class = "toolbarField" tabindex = "95" >
2022-02-05 19:10:53 +09:00
< label for = "findMatchCase" class = "toolbarLabel" data-l10n-id = "find_match_case_label" > Match Case< / label >
2017-03-09 07:54:28 +09:00
< / div >
2018-09-01 08:28:19 +09:00
< div id = "findbarOptionsTwoContainer" >
2021-04-19 06:37:22 +09:00
< input type = "checkbox" id = "findMatchDiacritics" class = "toolbarField" tabindex = "96" >
< label for = "findMatchDiacritics" class = "toolbarLabel" data-l10n-id = "find_match_diacritics_label" > Match Diacritics< / label >
< input type = "checkbox" id = "findEntireWord" class = "toolbarField" tabindex = "97" >
2022-02-05 19:10:53 +09:00
< label for = "findEntireWord" class = "toolbarLabel" data-l10n-id = "find_entire_word_label" > Whole Words< / label >
2021-04-19 06:37:22 +09:00
< / div >
2022-04-01 06:12:56 +09:00
< div id = "findbarMessageContainer" aria-live = "polite" >
2022-02-04 06:16:56 +09:00
< span id = "findResultsCount" class = "toolbarLabel" > < / span >
2017-03-09 07:54:28 +09:00
< span id = "findMsg" class = "toolbarLabel" > < / span >
2012-10-06 09:15:06 +09:00
< / div >
2013-09-05 06:48:31 +09:00
< / div > <!-- findbar -->
2022-06-14 01:23:10 +09:00
< div class = "editorParamsToolbar hidden doorHangerRight" id = "editorFreeTextParamsToolbar" >
< div class = "editorParamsToolbarContainer" >
< div class = "editorParamsSetter" >
2022-07-24 23:35:44 +09:00
< label for = "editorFreeTextColor" class = "editorParamsLabel" data-l10n-id = "editor_free_text_color" > Color< / label >
2022-06-29 18:13:23 +09:00
< input type = "color" id = "editorFreeTextColor" class = "editorParamsColor" tabindex = "100" >
2022-06-14 01:23:10 +09:00
< / div >
< div class = "editorParamsSetter" >
2022-07-24 23:35:44 +09:00
< label for = "editorFreeTextFontSize" class = "editorParamsLabel" data-l10n-id = "editor_free_text_size" > Size< / label >
2022-06-29 18:13:23 +09:00
< input type = "range" id = "editorFreeTextFontSize" class = "editorParamsSlider" value = "10" min = "5" max = "100" step = "1" tabindex = "101" >
2022-06-14 01:23:10 +09:00
< / div >
< / div >
< / div >
< div class = "editorParamsToolbar hidden doorHangerRight" id = "editorInkParamsToolbar" >
< div class = "editorParamsToolbarContainer" >
< div class = "editorParamsSetter" >
2022-07-24 23:35:44 +09:00
< label for = "editorInkColor" class = "editorParamsLabel" data-l10n-id = "editor_ink_color" > Color< / label >
2022-06-29 18:13:23 +09:00
< input type = "color" id = "editorInkColor" class = "editorParamsColor" tabindex = "102" >
2022-06-14 01:23:10 +09:00
< / div >
< div class = "editorParamsSetter" >
2022-07-24 23:35:44 +09:00
< label for = "editorInkThickness" class = "editorParamsLabel" data-l10n-id = "editor_ink_thickness" > Thickness< / label >
2022-06-29 18:13:23 +09:00
< input type = "range" id = "editorInkThickness" class = "editorParamsSlider" value = "1" min = "1" max = "20" step = "1" tabindex = "103" >
2022-06-14 01:23:10 +09:00
< / div >
2022-07-25 05:19:09 +09:00
< div class = "editorParamsSetter" >
2022-07-24 23:35:44 +09:00
< label for = "editorInkOpacity" class = "editorParamsLabel" data-l10n-id = "editor_ink_opacity" > Opacity< / label >
2022-07-25 05:19:09 +09:00
< input type = "range" id = "editorInkOpacity" class = "editorParamsSlider" value = "100" min = "1" max = "100" step = "1" tabindex = "104" >
< / div >
2022-06-14 01:23:10 +09:00
< / div >
< / div >
2013-09-05 06:48:31 +09:00
< div id = "secondaryToolbar" class = "secondaryToolbar hidden doorHangerRight" >
< div id = "secondaryToolbarButtonContainer" >
2022-04-27 23:04:00 +09:00
< button id = "secondaryPresentationMode" class = "secondaryToolbarButton visibleLargeView" title = "Switch to Presentation Mode" tabindex = "51" data-l10n-id = "presentation_mode" >
2013-09-05 06:48:31 +09:00
< span data-l10n-id = "presentation_mode_label" > Presentation Mode< / span >
< / button >
2022-05-08 05:05:39 +09:00
<!-- #if GENERIC -->
2022-04-27 23:04:00 +09:00
< button id = "secondaryOpenFile" class = "secondaryToolbarButton visibleLargeView" title = "Open File" tabindex = "52" data-l10n-id = "open_file" >
2013-09-05 06:48:31 +09:00
< span data-l10n-id = "open_file_label" > Open< / span >
< / button >
2022-04-25 17:06:47 +09:00
<!-- #endif -->
2013-09-05 06:48:31 +09:00
2022-04-27 23:04:00 +09:00
< button id = "secondaryPrint" class = "secondaryToolbarButton visibleMediumView" title = "Print" tabindex = "53" data-l10n-id = "print" >
2013-09-05 06:48:31 +09:00
< span data-l10n-id = "print_label" > Print< / span >
< / button >
2022-04-27 23:04:00 +09:00
< button id = "secondaryDownload" class = "secondaryToolbarButton visibleMediumView" title = "Download" tabindex = "54" data-l10n-id = "download" >
2013-09-05 06:48:31 +09:00
< span data-l10n-id = "download_label" > Download< / span >
< / button >
2022-04-27 23:04:00 +09:00
< a href = "#" id = "secondaryViewBookmark" class = "secondaryToolbarButton visibleSmallView" title = "Current view (copy or open in new window)" tabindex = "55" data-l10n-id = "bookmark" >
2013-09-27 18:44:45 +09:00
< span data-l10n-id = "bookmark_label" > Current View< / span >
< / a >
2013-09-05 06:48:31 +09:00
< div class = "horizontalToolbarSeparator visibleLargeView" > < / div >
2022-04-27 23:04:00 +09:00
< button id = "firstPage" class = "secondaryToolbarButton" title = "Go to First Page" tabindex = "56" data-l10n-id = "first_page" >
2013-09-05 06:48:31 +09:00
< span data-l10n-id = "first_page_label" > Go to First Page< / span >
< / button >
2022-04-27 23:04:00 +09:00
< button id = "lastPage" class = "secondaryToolbarButton" title = "Go to Last Page" tabindex = "57" data-l10n-id = "last_page" >
2013-09-05 06:48:31 +09:00
< span data-l10n-id = "last_page_label" > Go to Last Page< / span >
< / button >
< div class = "horizontalToolbarSeparator" > < / div >
2022-04-27 23:04:00 +09:00
< button id = "pageRotateCw" class = "secondaryToolbarButton" title = "Rotate Clockwise" tabindex = "58" data-l10n-id = "page_rotate_cw" >
2013-09-05 06:48:31 +09:00
< span data-l10n-id = "page_rotate_cw_label" > Rotate Clockwise< / span >
< / button >
2022-04-27 23:04:00 +09:00
< button id = "pageRotateCcw" class = "secondaryToolbarButton" title = "Rotate Counterclockwise" tabindex = "59" data-l10n-id = "page_rotate_ccw" >
2013-09-05 06:48:31 +09:00
< span data-l10n-id = "page_rotate_ccw_label" > Rotate Counterclockwise< / span >
< / button >
2013-10-03 05:09:43 +09:00
< div class = "horizontalToolbarSeparator" > < / div >
2022-02-11 22:04:47 +09:00
< div id = "cursorToolButtons" role = "radiogroup" >
2022-04-27 23:04:00 +09:00
< button id = "cursorSelectTool" class = "secondaryToolbarButton toggled" title = "Enable Text Selection Tool" tabindex = "60" data-l10n-id = "cursor_text_select_tool" role = "radio" aria-checked = "true" >
2022-02-11 22:04:47 +09:00
< span data-l10n-id = "cursor_text_select_tool_label" > Text Selection Tool< / span >
< / button >
2022-04-27 23:04:00 +09:00
< button id = "cursorHandTool" class = "secondaryToolbarButton" title = "Enable Hand Tool" tabindex = "61" data-l10n-id = "cursor_hand_tool" role = "radio" aria-checked = "false" >
2022-02-11 22:04:47 +09:00
< span data-l10n-id = "cursor_hand_tool_label" > Hand Tool< / span >
< / button >
< / div >
2015-02-03 00:12:52 +09:00
2014-01-22 08:07:07 +09:00
< div class = "horizontalToolbarSeparator" > < / div >
2022-02-11 22:04:47 +09:00
< div id = "scrollModeButtons" role = "radiogroup" >
2022-04-27 23:04:00 +09:00
< button id = "scrollPage" class = "secondaryToolbarButton" title = "Use Page Scrolling" tabindex = "62" data-l10n-id = "scroll_page" role = "radio" aria-checked = "false" >
2022-02-11 22:04:47 +09:00
< span data-l10n-id = "scroll_page_label" > Page Scrolling< / span >
< / button >
2022-04-27 23:04:00 +09:00
< button id = "scrollVertical" class = "secondaryToolbarButton toggled" title = "Use Vertical Scrolling" tabindex = "63" data-l10n-id = "scroll_vertical" role = "radio" aria-checked = "true" >
2022-02-11 22:04:47 +09:00
< span data-l10n-id = "scroll_vertical_label" > Vertical Scrolling< / span >
< / button >
2022-04-27 23:04:00 +09:00
< button id = "scrollHorizontal" class = "secondaryToolbarButton" title = "Use Horizontal Scrolling" tabindex = "64" data-l10n-id = "scroll_horizontal" role = "radio" aria-checked = "false" >
2022-02-11 22:04:47 +09:00
< span data-l10n-id = "scroll_horizontal_label" > Horizontal Scrolling< / span >
< / button >
2022-04-27 23:04:00 +09:00
< button id = "scrollWrapped" class = "secondaryToolbarButton" title = "Use Wrapped Scrolling" tabindex = "65" data-l10n-id = "scroll_wrapped" role = "radio" aria-checked = "false" >
2022-02-11 22:04:47 +09:00
< span data-l10n-id = "scroll_wrapped_label" > Wrapped Scrolling< / span >
< / button >
< / div >
2018-05-15 12:10:32 +09:00
2021-11-29 02:36:25 +09:00
< div class = "horizontalToolbarSeparator" > < / div >
2018-05-15 12:10:32 +09:00
2022-02-11 22:04:47 +09:00
< div id = "spreadModeButtons" role = "radiogroup" >
2022-04-27 23:04:00 +09:00
< button id = "spreadNone" class = "secondaryToolbarButton toggled" title = "Do not join page spreads" tabindex = "66" data-l10n-id = "spread_none" role = "radio" aria-checked = "true" >
2022-02-11 22:04:47 +09:00
< span data-l10n-id = "spread_none_label" > No Spreads< / span >
< / button >
2022-04-27 23:04:00 +09:00
< button id = "spreadOdd" class = "secondaryToolbarButton" title = "Join page spreads starting with odd-numbered pages" tabindex = "67" data-l10n-id = "spread_odd" role = "radio" aria-checked = "false" >
2022-02-11 22:04:47 +09:00
< span data-l10n-id = "spread_odd_label" > Odd Spreads< / span >
< / button >
2022-04-27 23:04:00 +09:00
< button id = "spreadEven" class = "secondaryToolbarButton" title = "Join page spreads starting with even-numbered pages" tabindex = "68" data-l10n-id = "spread_even" role = "radio" aria-checked = "false" >
2022-02-11 22:04:47 +09:00
< span data-l10n-id = "spread_even_label" > Even Spreads< / span >
< / button >
< / div >
2018-05-15 12:10:32 +09:00
2021-11-29 02:36:25 +09:00
< div class = "horizontalToolbarSeparator" > < / div >
2018-05-15 12:10:32 +09:00
2022-04-27 23:04:00 +09:00
< button id = "documentProperties" class = "secondaryToolbarButton" title = "Document Properties…" tabindex = "69" data-l10n-id = "document_properties" aria-controls = "documentPropertiesDialog" >
2014-01-23 08:30:48 +09:00
< span data-l10n-id = "document_properties_label" > Document Properties…< / span >
2014-01-22 08:07:07 +09:00
< / button >
2013-09-05 06:48:31 +09:00
< / div >
< / div > <!-- secondaryToolbar -->
2012-04-26 03:34:28 +09:00
< div class = "toolbar" >
< div id = "toolbarContainer" >
< div id = "toolbarViewer" >
< div id = "toolbarViewerLeft" >
2021-02-02 07:16:20 +09:00
< button id = "sidebarToggle" class = "toolbarButton" title = "Toggle Sidebar" tabindex = "11" data-l10n-id = "toggle_sidebar" aria-expanded = "false" aria-controls = "sidebarContainer" >
2013-01-31 22:14:48 +09:00
< span data-l10n-id = "toggle_sidebar_label" > Toggle Sidebar< / span >
2012-05-04 23:51:21 +09:00
< / button >
2012-04-26 03:34:28 +09:00
< div class = "toolbarButtonSpacer" > < / div >
2021-02-02 07:16:20 +09:00
< button id = "viewFind" class = "toolbarButton" title = "Find in Document" tabindex = "12" data-l10n-id = "findbar" aria-expanded = "false" aria-controls = "findbar" >
2017-03-12 17:42:20 +09:00
< span data-l10n-id = "findbar_label" > Find< / span >
2012-09-29 04:30:07 +09:00
< / button >
2017-03-09 07:54:28 +09:00
< div class = "splitToolbarButton hiddenSmallView" >
2022-04-27 23:04:00 +09:00
< button class = "toolbarButton" title = "Previous Page" id = "previous" tabindex = "13" data-l10n-id = "previous" >
2012-05-05 03:13:29 +09:00
< span data-l10n-id = "previous_label" > Previous< / span >
2012-05-04 23:51:21 +09:00
< / button >
2012-04-26 03:34:28 +09:00
< div class = "splitToolbarButtonSeparator" > < / div >
2022-04-27 23:04:00 +09:00
< button class = "toolbarButton" title = "Next Page" id = "next" tabindex = "14" data-l10n-id = "next" >
2012-05-05 03:13:29 +09:00
< span data-l10n-id = "next_label" > Next< / span >
2012-05-04 23:51:21 +09:00
< / button >
2012-04-26 03:34:28 +09:00
< / div >
2022-04-27 23:04:00 +09:00
< input type = "number" id = "pageNumber" class = "toolbarField" title = "Page" value = "1" size = "4" min = "1" tabindex = "15" data-l10n-id = "page" autocomplete = "off" >
2012-04-26 03:34:28 +09:00
< span id = "numPages" class = "toolbarLabel" > < / span >
< / div >
< div id = "toolbarViewerRight" >
[editor] Support disabling of editing when `pdfjs.enablePermissions` is set (issue 15049)
For encrypted PDF documents without the required permissions set, this patch adds support for disabling of Annotation-editing. However, please note that it also requires that the `pdfjs.enablePermissions` preference is set to `true` (since PDF document permissions could be seen as user hostile).[1]
As I started looking at the issue, it soon became clear that *only* trying to fix the issue without slightly re-factor the surrounding code would be somewhat difficult.
The following is an overview of the changes in this patch; sorry about the size/scope of this!
- Use a new `AnnotationEditorUIManager`-instance *for each* PDF document opened in the GENERIC viewer, to prevent user-added Annotations from "leaking" from one document into the next.
- Re-factor the `BaseViewer.#initializePermissions`-method, to simplify handling of temporarily disabled modes (e.g. for both Annotation-rendering and Annotation-editing).
- When editing is enabled, let the Editor-buttons be `disabled` until the document has loaded. This way we avoid the buttons becoming clickable temporarily, for PDF documents that use permissions.
- Slightly re-factor how the Editor-buttons are shown/hidden in the viewer, and reset the toolbar-state when a new PDF document is opened.
- Flip the order of the Editor-buttons and the pre-exising toolbarButtons in the "toolbarViewerRight"-div. (To help reduce the size, a little bit, for the PR that adds new Editor-toolbars.)
- Enable editing by default in the development viewer, i.e. `gulp server`, since having to (repeatedly) do that manually becomes annoying after a while.
- Finally, support disabling of editing when `pdfjs.enablePermissions` is set; fixes issue 15049.
---
[1] Either manually with `about:config`, or using e.g. a [Group Policy](https://github.com/mozilla/policy-templates).
2022-06-21 01:08:41 +09:00
< button id = "presentationMode" class = "toolbarButton hiddenLargeView" title = "Switch to Presentation Mode" tabindex = "31" data-l10n-id = "presentation_mode" >
2012-09-21 23:35:18 +09:00
< span data-l10n-id = "presentation_mode_label" > Presentation Mode< / span >
2012-07-31 00:58:34 +09:00
< / button >
2012-07-31 00:12:49 +09:00
2022-05-08 05:05:39 +09:00
<!-- #if GENERIC -->
[editor] Support disabling of editing when `pdfjs.enablePermissions` is set (issue 15049)
For encrypted PDF documents without the required permissions set, this patch adds support for disabling of Annotation-editing. However, please note that it also requires that the `pdfjs.enablePermissions` preference is set to `true` (since PDF document permissions could be seen as user hostile).[1]
As I started looking at the issue, it soon became clear that *only* trying to fix the issue without slightly re-factor the surrounding code would be somewhat difficult.
The following is an overview of the changes in this patch; sorry about the size/scope of this!
- Use a new `AnnotationEditorUIManager`-instance *for each* PDF document opened in the GENERIC viewer, to prevent user-added Annotations from "leaking" from one document into the next.
- Re-factor the `BaseViewer.#initializePermissions`-method, to simplify handling of temporarily disabled modes (e.g. for both Annotation-rendering and Annotation-editing).
- When editing is enabled, let the Editor-buttons be `disabled` until the document has loaded. This way we avoid the buttons becoming clickable temporarily, for PDF documents that use permissions.
- Slightly re-factor how the Editor-buttons are shown/hidden in the viewer, and reset the toolbar-state when a new PDF document is opened.
- Flip the order of the Editor-buttons and the pre-exising toolbarButtons in the "toolbarViewerRight"-div. (To help reduce the size, a little bit, for the PR that adds new Editor-toolbars.)
- Enable editing by default in the development viewer, i.e. `gulp server`, since having to (repeatedly) do that manually becomes annoying after a while.
- Finally, support disabling of editing when `pdfjs.enablePermissions` is set; fixes issue 15049.
---
[1] Either manually with `about:config`, or using e.g. a [Group Policy](https://github.com/mozilla/policy-templates).
2022-06-21 01:08:41 +09:00
< button id = "openFile" class = "toolbarButton hiddenLargeView" title = "Open File" tabindex = "32" data-l10n-id = "open_file" >
2013-09-05 06:48:31 +09:00
< span data-l10n-id = "open_file_label" > Open< / span >
2012-05-04 23:51:21 +09:00
< / button >
2022-04-25 17:06:47 +09:00
<!-- #endif -->
2012-05-02 01:43:48 +09:00
[editor] Support disabling of editing when `pdfjs.enablePermissions` is set (issue 15049)
For encrypted PDF documents without the required permissions set, this patch adds support for disabling of Annotation-editing. However, please note that it also requires that the `pdfjs.enablePermissions` preference is set to `true` (since PDF document permissions could be seen as user hostile).[1]
As I started looking at the issue, it soon became clear that *only* trying to fix the issue without slightly re-factor the surrounding code would be somewhat difficult.
The following is an overview of the changes in this patch; sorry about the size/scope of this!
- Use a new `AnnotationEditorUIManager`-instance *for each* PDF document opened in the GENERIC viewer, to prevent user-added Annotations from "leaking" from one document into the next.
- Re-factor the `BaseViewer.#initializePermissions`-method, to simplify handling of temporarily disabled modes (e.g. for both Annotation-rendering and Annotation-editing).
- When editing is enabled, let the Editor-buttons be `disabled` until the document has loaded. This way we avoid the buttons becoming clickable temporarily, for PDF documents that use permissions.
- Slightly re-factor how the Editor-buttons are shown/hidden in the viewer, and reset the toolbar-state when a new PDF document is opened.
- Flip the order of the Editor-buttons and the pre-exising toolbarButtons in the "toolbarViewerRight"-div. (To help reduce the size, a little bit, for the PR that adds new Editor-toolbars.)
- Enable editing by default in the development viewer, i.e. `gulp server`, since having to (repeatedly) do that manually becomes annoying after a while.
- Finally, support disabling of editing when `pdfjs.enablePermissions` is set; fixes issue 15049.
---
[1] Either manually with `about:config`, or using e.g. a [Group Policy](https://github.com/mozilla/policy-templates).
2022-06-21 01:08:41 +09:00
< button id = "print" class = "toolbarButton hiddenMediumView" title = "Print" tabindex = "33" data-l10n-id = "print" >
2012-05-05 03:13:29 +09:00
< span data-l10n-id = "print_label" > Print< / span >
2012-05-04 23:51:21 +09:00
< / button >
[editor] Support disabling of editing when `pdfjs.enablePermissions` is set (issue 15049)
For encrypted PDF documents without the required permissions set, this patch adds support for disabling of Annotation-editing. However, please note that it also requires that the `pdfjs.enablePermissions` preference is set to `true` (since PDF document permissions could be seen as user hostile).[1]
As I started looking at the issue, it soon became clear that *only* trying to fix the issue without slightly re-factor the surrounding code would be somewhat difficult.
The following is an overview of the changes in this patch; sorry about the size/scope of this!
- Use a new `AnnotationEditorUIManager`-instance *for each* PDF document opened in the GENERIC viewer, to prevent user-added Annotations from "leaking" from one document into the next.
- Re-factor the `BaseViewer.#initializePermissions`-method, to simplify handling of temporarily disabled modes (e.g. for both Annotation-rendering and Annotation-editing).
- When editing is enabled, let the Editor-buttons be `disabled` until the document has loaded. This way we avoid the buttons becoming clickable temporarily, for PDF documents that use permissions.
- Slightly re-factor how the Editor-buttons are shown/hidden in the viewer, and reset the toolbar-state when a new PDF document is opened.
- Flip the order of the Editor-buttons and the pre-exising toolbarButtons in the "toolbarViewerRight"-div. (To help reduce the size, a little bit, for the PR that adds new Editor-toolbars.)
- Enable editing by default in the development viewer, i.e. `gulp server`, since having to (repeatedly) do that manually becomes annoying after a while.
- Finally, support disabling of editing when `pdfjs.enablePermissions` is set; fixes issue 15049.
---
[1] Either manually with `about:config`, or using e.g. a [Group Policy](https://github.com/mozilla/policy-templates).
2022-06-21 01:08:41 +09:00
< button id = "download" class = "toolbarButton hiddenMediumView" title = "Download" tabindex = "34" data-l10n-id = "download" >
2012-05-05 03:13:29 +09:00
< span data-l10n-id = "download_label" > Download< / span >
2012-05-04 23:51:21 +09:00
< / button >
[editor] Support disabling of editing when `pdfjs.enablePermissions` is set (issue 15049)
For encrypted PDF documents without the required permissions set, this patch adds support for disabling of Annotation-editing. However, please note that it also requires that the `pdfjs.enablePermissions` preference is set to `true` (since PDF document permissions could be seen as user hostile).[1]
As I started looking at the issue, it soon became clear that *only* trying to fix the issue without slightly re-factor the surrounding code would be somewhat difficult.
The following is an overview of the changes in this patch; sorry about the size/scope of this!
- Use a new `AnnotationEditorUIManager`-instance *for each* PDF document opened in the GENERIC viewer, to prevent user-added Annotations from "leaking" from one document into the next.
- Re-factor the `BaseViewer.#initializePermissions`-method, to simplify handling of temporarily disabled modes (e.g. for both Annotation-rendering and Annotation-editing).
- When editing is enabled, let the Editor-buttons be `disabled` until the document has loaded. This way we avoid the buttons becoming clickable temporarily, for PDF documents that use permissions.
- Slightly re-factor how the Editor-buttons are shown/hidden in the viewer, and reset the toolbar-state when a new PDF document is opened.
- Flip the order of the Editor-buttons and the pre-exising toolbarButtons in the "toolbarViewerRight"-div. (To help reduce the size, a little bit, for the PR that adds new Editor-toolbars.)
- Enable editing by default in the development viewer, i.e. `gulp server`, since having to (repeatedly) do that manually becomes annoying after a while.
- Finally, support disabling of editing when `pdfjs.enablePermissions` is set; fixes issue 15049.
---
[1] Either manually with `about:config`, or using e.g. a [Group Policy](https://github.com/mozilla/policy-templates).
2022-06-21 01:08:41 +09:00
< a href = "#" id = "viewBookmark" class = "toolbarButton hiddenSmallView" title = "Current view (copy or open in new window)" tabindex = "35" data-l10n-id = "bookmark" >
2013-09-27 18:44:45 +09:00
< span data-l10n-id = "bookmark_label" > Current View< / span >
< / a >
2013-09-05 06:48:31 +09:00
< div class = "verticalToolbarSeparator hiddenSmallView" > < / div >
2015-02-03 00:12:52 +09:00
[editor] Support disabling of editing when `pdfjs.enablePermissions` is set (issue 15049)
For encrypted PDF documents without the required permissions set, this patch adds support for disabling of Annotation-editing. However, please note that it also requires that the `pdfjs.enablePermissions` preference is set to `true` (since PDF document permissions could be seen as user hostile).[1]
As I started looking at the issue, it soon became clear that *only* trying to fix the issue without slightly re-factor the surrounding code would be somewhat difficult.
The following is an overview of the changes in this patch; sorry about the size/scope of this!
- Use a new `AnnotationEditorUIManager`-instance *for each* PDF document opened in the GENERIC viewer, to prevent user-added Annotations from "leaking" from one document into the next.
- Re-factor the `BaseViewer.#initializePermissions`-method, to simplify handling of temporarily disabled modes (e.g. for both Annotation-rendering and Annotation-editing).
- When editing is enabled, let the Editor-buttons be `disabled` until the document has loaded. This way we avoid the buttons becoming clickable temporarily, for PDF documents that use permissions.
- Slightly re-factor how the Editor-buttons are shown/hidden in the viewer, and reset the toolbar-state when a new PDF document is opened.
- Flip the order of the Editor-buttons and the pre-exising toolbarButtons in the "toolbarViewerRight"-div. (To help reduce the size, a little bit, for the PR that adds new Editor-toolbars.)
- Enable editing by default in the development viewer, i.e. `gulp server`, since having to (repeatedly) do that manually becomes annoying after a while.
- Finally, support disabling of editing when `pdfjs.enablePermissions` is set; fixes issue 15049.
---
[1] Either manually with `about:config`, or using e.g. a [Group Policy](https://github.com/mozilla/policy-templates).
2022-06-21 01:08:41 +09:00
< div id = "editorModeButtons" class = "splitToolbarButton toggled hidden" role = "radiogroup" >
2022-08-26 06:18:02 +09:00
< button id = "editorFreeText" class = "toolbarButton" disabled = "disabled" title = "Add FreeText Annotation" role = "radio" aria-checked = "false" tabindex = "36" data-l10n-id = "editor_free_text" >
[editor] Support disabling of editing when `pdfjs.enablePermissions` is set (issue 15049)
For encrypted PDF documents without the required permissions set, this patch adds support for disabling of Annotation-editing. However, please note that it also requires that the `pdfjs.enablePermissions` preference is set to `true` (since PDF document permissions could be seen as user hostile).[1]
As I started looking at the issue, it soon became clear that *only* trying to fix the issue without slightly re-factor the surrounding code would be somewhat difficult.
The following is an overview of the changes in this patch; sorry about the size/scope of this!
- Use a new `AnnotationEditorUIManager`-instance *for each* PDF document opened in the GENERIC viewer, to prevent user-added Annotations from "leaking" from one document into the next.
- Re-factor the `BaseViewer.#initializePermissions`-method, to simplify handling of temporarily disabled modes (e.g. for both Annotation-rendering and Annotation-editing).
- When editing is enabled, let the Editor-buttons be `disabled` until the document has loaded. This way we avoid the buttons becoming clickable temporarily, for PDF documents that use permissions.
- Slightly re-factor how the Editor-buttons are shown/hidden in the viewer, and reset the toolbar-state when a new PDF document is opened.
- Flip the order of the Editor-buttons and the pre-exising toolbarButtons in the "toolbarViewerRight"-div. (To help reduce the size, a little bit, for the PR that adds new Editor-toolbars.)
- Enable editing by default in the development viewer, i.e. `gulp server`, since having to (repeatedly) do that manually becomes annoying after a while.
- Finally, support disabling of editing when `pdfjs.enablePermissions` is set; fixes issue 15049.
---
[1] Either manually with `about:config`, or using e.g. a [Group Policy](https://github.com/mozilla/policy-templates).
2022-06-21 01:08:41 +09:00
< span data-l10n-id = "editor_free_text_label" > FreeText Annotation< / span >
< / button >
2022-08-26 06:18:02 +09:00
< button id = "editorInk" class = "toolbarButton" disabled = "disabled" title = "Add Ink Annotation" role = "radio" aria-checked = "false" tabindex = "37" data-l10n-id = "editor_ink" >
[editor] Support disabling of editing when `pdfjs.enablePermissions` is set (issue 15049)
For encrypted PDF documents without the required permissions set, this patch adds support for disabling of Annotation-editing. However, please note that it also requires that the `pdfjs.enablePermissions` preference is set to `true` (since PDF document permissions could be seen as user hostile).[1]
As I started looking at the issue, it soon became clear that *only* trying to fix the issue without slightly re-factor the surrounding code would be somewhat difficult.
The following is an overview of the changes in this patch; sorry about the size/scope of this!
- Use a new `AnnotationEditorUIManager`-instance *for each* PDF document opened in the GENERIC viewer, to prevent user-added Annotations from "leaking" from one document into the next.
- Re-factor the `BaseViewer.#initializePermissions`-method, to simplify handling of temporarily disabled modes (e.g. for both Annotation-rendering and Annotation-editing).
- When editing is enabled, let the Editor-buttons be `disabled` until the document has loaded. This way we avoid the buttons becoming clickable temporarily, for PDF documents that use permissions.
- Slightly re-factor how the Editor-buttons are shown/hidden in the viewer, and reset the toolbar-state when a new PDF document is opened.
- Flip the order of the Editor-buttons and the pre-exising toolbarButtons in the "toolbarViewerRight"-div. (To help reduce the size, a little bit, for the PR that adds new Editor-toolbars.)
- Enable editing by default in the development viewer, i.e. `gulp server`, since having to (repeatedly) do that manually becomes annoying after a while.
- Finally, support disabling of editing when `pdfjs.enablePermissions` is set; fixes issue 15049.
---
[1] Either manually with `about:config`, or using e.g. a [Group Policy](https://github.com/mozilla/policy-templates).
2022-06-21 01:08:41 +09:00
< span data-l10n-id = "editor_ink_label" > Ink Annotation< / span >
< / button >
< / div >
<!-- Should be visible when the "editorModeButtons" are visible. -->
< div id = "editorModeSeparator" class = "verticalToolbarSeparator hidden" > < / div >
2022-06-01 17:38:08 +09:00
< button id = "secondaryToolbarToggle" class = "toolbarButton" title = "Tools" tabindex = "48" data-l10n-id = "tools" aria-expanded = "false" aria-controls = "secondaryToolbar" >
2013-09-05 06:48:31 +09:00
< span data-l10n-id = "tools_label" > Tools< / span >
2015-02-03 00:12:52 +09:00
< / button >
2012-04-26 03:34:28 +09:00
< / div >
2016-11-04 00:56:57 +09:00
< div id = "toolbarViewerMiddle" >
< div class = "splitToolbarButton" >
2022-04-27 23:04:00 +09:00
< button id = "zoomOut" class = "toolbarButton" title = "Zoom Out" tabindex = "21" data-l10n-id = "zoom_out" >
2016-11-04 00:56:57 +09:00
< span data-l10n-id = "zoom_out_label" > Zoom Out< / span >
< / button >
< div class = "splitToolbarButtonSeparator" > < / div >
2022-04-27 23:04:00 +09:00
< button id = "zoomIn" class = "toolbarButton" title = "Zoom In" tabindex = "22" data-l10n-id = "zoom_in" >
2016-11-04 00:56:57 +09:00
< span data-l10n-id = "zoom_in_label" > Zoom In< / span >
< / button >
2012-04-26 03:34:28 +09:00
< / div >
2016-11-04 00:56:57 +09:00
< span id = "scaleSelectContainer" class = "dropdownToolbarButton" >
< select id = "scaleSelect" title = "Zoom" tabindex = "23" data-l10n-id = "zoom" >
< option id = "pageAutoOption" title = "" value = "auto" selected = "selected" data-l10n-id = "page_scale_auto" > Automatic Zoom< / option >
< option id = "pageActualOption" title = "" value = "page-actual" data-l10n-id = "page_scale_actual" > Actual Size< / option >
2017-07-11 04:27:39 +09:00
< option id = "pageFitOption" title = "" value = "page-fit" data-l10n-id = "page_scale_fit" > Page Fit< / option >
< option id = "pageWidthOption" title = "" value = "page-width" data-l10n-id = "page_scale_width" > Page Width< / option >
2016-11-08 20:04:55 +09:00
< option id = "customScaleOption" title = "" value = "custom" disabled = "disabled" hidden = "true" > < / option >
2016-11-04 00:56:57 +09:00
< option title = "" value = "0.5" data-l10n-id = "page_scale_percent" data-l10n-args = '{ "scale": 50 }' > 50%< / option >
< option title = "" value = "0.75" data-l10n-id = "page_scale_percent" data-l10n-args = '{ "scale": 75 }' > 75%< / option >
< option title = "" value = "1" data-l10n-id = "page_scale_percent" data-l10n-args = '{ "scale": 100 }' > 100%< / option >
< option title = "" value = "1.25" data-l10n-id = "page_scale_percent" data-l10n-args = '{ "scale": 125 }' > 125%< / option >
< option title = "" value = "1.5" data-l10n-id = "page_scale_percent" data-l10n-args = '{ "scale": 150 }' > 150%< / option >
< option title = "" value = "2" data-l10n-id = "page_scale_percent" data-l10n-args = '{ "scale": 200 }' > 200%< / option >
< option title = "" value = "3" data-l10n-id = "page_scale_percent" data-l10n-args = '{ "scale": 300 }' > 300%< / option >
< option title = "" value = "4" data-l10n-id = "page_scale_percent" data-l10n-args = '{ "scale": 400 }' > 400%< / option >
< / select >
< / span >
2012-04-26 03:34:28 +09:00
< / div >
< / div >
2013-02-07 08:19:29 +09:00
< div id = "loadingBar" >
< div class = "progress" >
< div class = "glimmer" >
< / div >
< / div >
< / div >
2011-12-12 10:38:20 +09:00
< / div >
< / div >
2011-05-26 23:02:52 +09:00
2013-07-06 22:37:03 +09:00
< div id = "viewerContainer" tabindex = "0" >
2014-10-01 00:48:29 +09:00
< div id = "viewer" class = "pdfViewer" > < / div >
2011-07-29 02:48:05 +09:00
< / div >
2012-04-12 08:12:51 +09:00
2021-02-14 18:39:34 +09:00
<!-- #if !MOZCENTRAL -->
2012-04-26 09:20:13 +09:00
< div id = "errorWrapper" hidden = 'true' >
< div id = "errorMessageLeft" >
< span id = "errorMessage" > < / span >
2013-07-18 07:40:15 +09:00
< button id = "errorShowMore" data-l10n-id = "error_more_info" >
2012-04-26 09:20:13 +09:00
More Information
< / button >
2013-07-18 07:40:15 +09:00
< button id = "errorShowLess" data-l10n-id = "error_less_info" hidden = 'true' >
2012-04-26 09:20:13 +09:00
Less Information
< / button >
< / div >
< div id = "errorMessageRight" >
2013-07-18 07:40:15 +09:00
< button id = "errorClose" data-l10n-id = "error_close" >
2012-04-26 09:20:13 +09:00
Close
< / button >
< / div >
2022-04-20 21:21:51 +09:00
< div id = "errorSpacer" > < / div >
2012-04-26 09:20:13 +09:00
< textarea id = "errorMoreInfo" hidden = 'true' readonly = "readonly" > < / textarea >
2011-08-22 11:05:10 +09:00
< / div >
2021-02-14 18:39:34 +09:00
<!-- #endif -->
2012-04-26 03:34:28 +09:00
< / div > <!-- mainContainer -->
2011-10-28 21:32:36 +09:00
2022-03-25 22:10:13 +09:00
< div id = "dialogContainer" >
< dialog id = "passwordDialog" >
< div class = "row" >
2022-03-25 22:10:28 +09:00
< label for = "password" id = "passwordText" data-l10n-id = "password_label" > Enter the password to open this PDF file:< / label >
2014-01-22 08:07:07 +09:00
< / div >
2022-03-25 22:10:13 +09:00
< div class = "row" >
< input type = "password" id = "password" class = "toolbarField" >
2013-09-25 00:46:54 +09:00
< / div >
2022-03-25 22:10:13 +09:00
< div class = "buttonRow" >
< button id = "passwordCancel" class = "dialogButton" > < span data-l10n-id = "password_cancel" > Cancel< / span > < / button >
< button id = "passwordSubmit" class = "dialogButton" > < span data-l10n-id = "password_ok" > OK< / span > < / button >
< / div >
< / dialog >
< dialog id = "documentPropertiesDialog" >
< div class = "row" >
2022-03-25 22:10:28 +09:00
< span id = "fileNameLabel" data-l10n-id = "document_properties_file_name" > File name:< / span >
< p id = "fileNameField" aria-labelledby = "fileNameLabel" > -< / p >
2022-03-25 22:10:13 +09:00
< / div >
< div class = "row" >
2022-03-25 22:10:28 +09:00
< span id = "fileSizeLabel" data-l10n-id = "document_properties_file_size" > File size:< / span >
< p id = "fileSizeField" aria-labelledby = "fileSizeLabel" > -< / p >
2022-03-25 22:10:13 +09:00
< / div >
< div class = "separator" > < / div >
< div class = "row" >
2022-03-25 22:10:28 +09:00
< span id = "titleLabel" data-l10n-id = "document_properties_title" > Title:< / span >
< p id = "titleField" aria-labelledby = "titleLabel" > -< / p >
2022-03-25 22:10:13 +09:00
< / div >
< div class = "row" >
2022-03-25 22:10:28 +09:00
< span id = "authorLabel" data-l10n-id = "document_properties_author" > Author:< / span >
< p id = "authorField" aria-labelledby = "authorLabel" > -< / p >
2022-03-25 22:10:13 +09:00
< / div >
< div class = "row" >
2022-03-25 22:10:28 +09:00
< span id = "subjectLabel" data-l10n-id = "document_properties_subject" > Subject:< / span >
< p id = "subjectField" aria-labelledby = "subjectLabel" > -< / p >
2022-03-25 22:10:13 +09:00
< / div >
< div class = "row" >
2022-03-25 22:10:28 +09:00
< span id = "keywordsLabel" data-l10n-id = "document_properties_keywords" > Keywords:< / span >
< p id = "keywordsField" aria-labelledby = "keywordsLabel" > -< / p >
2022-03-25 22:10:13 +09:00
< / div >
< div class = "row" >
2022-03-25 22:10:28 +09:00
< span id = "creationDateLabel" data-l10n-id = "document_properties_creation_date" > Creation Date:< / span >
< p id = "creationDateField" aria-labelledby = "creationDateLabel" > -< / p >
2022-03-25 22:10:13 +09:00
< / div >
< div class = "row" >
2022-03-25 22:10:28 +09:00
< span id = "modificationDateLabel" data-l10n-id = "document_properties_modification_date" > Modification Date:< / span >
< p id = "modificationDateField" aria-labelledby = "modificationDateLabel" > -< / p >
2022-03-25 22:10:13 +09:00
< / div >
< div class = "row" >
2022-03-25 22:10:28 +09:00
< span id = "creatorLabel" data-l10n-id = "document_properties_creator" > Creator:< / span >
< p id = "creatorField" aria-labelledby = "creatorLabel" > -< / p >
2022-03-25 22:10:13 +09:00
< / div >
< div class = "separator" > < / div >
< div class = "row" >
2022-03-25 22:10:28 +09:00
< span id = "producerLabel" data-l10n-id = "document_properties_producer" > PDF Producer:< / span >
< p id = "producerField" aria-labelledby = "producerLabel" > -< / p >
2022-03-25 22:10:13 +09:00
< / div >
< div class = "row" >
2022-03-25 22:10:28 +09:00
< span id = "versionLabel" data-l10n-id = "document_properties_version" > PDF Version:< / span >
< p id = "versionField" aria-labelledby = "versionLabel" > -< / p >
2022-03-25 22:10:13 +09:00
< / div >
< div class = "row" >
2022-03-25 22:10:28 +09:00
< span id = "pageCountLabel" data-l10n-id = "document_properties_page_count" > Page Count:< / span >
< p id = "pageCountField" aria-labelledby = "pageCountLabel" > -< / p >
2022-03-25 22:10:13 +09:00
< / div >
< div class = "row" >
2022-03-25 22:10:28 +09:00
< span id = "pageSizeLabel" data-l10n-id = "document_properties_page_size" > Page Size:< / span >
< p id = "pageSizeField" aria-labelledby = "pageSizeLabel" > -< / p >
2022-03-25 22:10:13 +09:00
< / div >
< div class = "separator" > < / div >
< div class = "row" >
2022-03-25 22:10:28 +09:00
< span id = "linearizedLabel" data-l10n-id = "document_properties_linearized" > Fast Web View:< / span >
< p id = "linearizedField" aria-labelledby = "linearizedLabel" > -< / p >
2022-03-25 22:10:13 +09:00
< / div >
< div class = "buttonRow" >
< button id = "documentPropertiesClose" class = "dialogButton" > < span data-l10n-id = "document_properties_close" > Close< / span > < / button >
< / div >
< / dialog >
2020-01-08 21:57:31 +09:00
<!-- #if !MOZCENTRAL -->
2022-03-25 22:10:28 +09:00
< dialog id = "printServiceDialog" style = "min-width: 200px;" >
2022-03-25 22:10:13 +09:00
< div class = "row" >
< span data-l10n-id = "print_progress_message" > Preparing document for printing…< / span >
2016-10-08 21:36:55 +09:00
< / div >
2022-03-25 22:10:13 +09:00
< div class = "row" >
< progress value = "0" max = "100" > < / progress >
< span data-l10n-id = "print_progress_percent" data-l10n-args = '{ "progress": 0 }' class = "relative-progress" > 0%< / span >
< / div >
< div class = "buttonRow" >
< button id = "printCancel" class = "dialogButton" > < span data-l10n-id = "print_progress_close" > Cancel< / span > < / button >
< / div >
< / dialog >
2016-10-08 21:36:55 +09:00
<!-- #endif -->
2015-07-19 00:11:33 +09:00
<!-- #if CHROME -->
<!-- #include viewer - snippet - chrome - overlays.html -->
<!-- #endif -->
2022-03-25 22:10:13 +09:00
< / div > <!-- dialogContainer -->
2013-09-25 00:46:54 +09:00
2012-04-13 08:29:15 +09:00
< / div > <!-- outerContainer -->
2012-06-29 01:50:25 +09:00
< div id = "printContainer" > < / div >
2022-04-09 23:30:02 +09:00
2022-05-08 05:05:39 +09:00
<!-- #if GENERIC -->
2022-04-09 23:30:02 +09:00
< input type = "file" id = "fileInput" class = "hidden" >
<!-- #endif -->
2011-05-26 23:02:52 +09:00
< / body >
2011-05-05 09:32:59 +09:00
< / html >