A couple of small improvements of the PDFViewerApplication.{_initializeMetadata, _initializePdfHistory}
methods
- Use template strings when printing document/viewer information in `_initializeMetadata`, since the old format feels overly verbose. Also, get the WebGL state from the `BaseViewer` instance[1] rather than the `AppOptions`. Since the `AppOptions` value could theoretically have been changed (by the user) after the viewer components were initialized, it seems much more useful to print the *actual* value that'll be used during rendering. - Change `_initializePdfHistory` to actually do the "is embedded"-check first, in accordance with the comment and given that the "disableHistory" option usually shouldn't be set. --- [1] Admittedly reaching into the `BaseViewer` instance and just grabbing the value perhaps isn't a great approach overall, but given that the WebGL-backend isn't even on by default this probably doesn't matter too much.
This commit is contained in:
parent
b9add65099
commit
9ef58347ed
19
web/app.js
19
web/app.js
@ -1270,19 +1270,10 @@ const PDFViewerApplication = {
|
|||||||
|
|
||||||
// Provides some basic debug information
|
// Provides some basic debug information
|
||||||
console.log(
|
console.log(
|
||||||
"PDF " +
|
`PDF ${pdfDocument.fingerprint} [${info.PDFFormatVersion} ` +
|
||||||
pdfDocument.fingerprint +
|
`${(info.Producer || "-").trim()} / ${(info.Creator || "-").trim()}] ` +
|
||||||
" [" +
|
`(PDF.js: ${version || "-"}` +
|
||||||
info.PDFFormatVersion +
|
`${this.pdfViewer.enableWebGL ? " [WebGL]" : ""})`
|
||||||
" " +
|
|
||||||
(info.Producer || "-").trim() +
|
|
||||||
" / " +
|
|
||||||
(info.Creator || "-").trim() +
|
|
||||||
"]" +
|
|
||||||
" (PDF.js: " +
|
|
||||||
(version || "-") +
|
|
||||||
(AppOptions.get("enableWebGL") ? " [WebGL]" : "") +
|
|
||||||
")"
|
|
||||||
);
|
);
|
||||||
|
|
||||||
let pdfTitle;
|
let pdfTitle;
|
||||||
@ -1444,7 +1435,7 @@ const PDFViewerApplication = {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_initializePdfHistory({ fingerprint, viewOnLoad, initialDest = null }) {
|
_initializePdfHistory({ fingerprint, viewOnLoad, initialDest = null }) {
|
||||||
if (AppOptions.get("disableHistory") || this.isViewerEmbedded) {
|
if (this.isViewerEmbedded || AppOptions.get("disableHistory")) {
|
||||||
// The browsing history is only enabled when the viewer is standalone,
|
// The browsing history is only enabled when the viewer is standalone,
|
||||||
// i.e. not when it is embedded in a web page.
|
// i.e. not when it is embedded in a web page.
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user