Skip to content

Commit

Permalink
Upgrade PDF.js to v4.10.38
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Yu committed Jan 3, 2025
1 parent c3a5952 commit ed5efd9
Show file tree
Hide file tree
Showing 63 changed files with 2,179 additions and 375 deletions.
8 changes: 4 additions & 4 deletions dev/editviewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
.replace('''localStorage.setItem("pdfjs.preferences", JSON.stringify(prefObj));''', '''// localStorage.setItem("pdfjs.preferences", JSON.stringify(prefObj));''') \
.replace('''prefs: JSON.parse(localStorage.getItem("pdfjs.preferences"))''', '''prefs: undefined // JSON.parse(localStorage.getItem("pdfjs.preferences"))''') \
.replace('''(!event.shiftKey || window.chrome || window.opera)) {''', '''(!event.shiftKey || window.chrome || window.opera)) {\n if (window.parent !== window) {\n return;\n }''') \
.replace('''console.error(`webviewerloaded: ''', '''// console.error(`webviewerloaded: ''') \
.replace('''console.error("webviewerloaded:", ex);''', '''// console.error("webviewerloaded:", ex);''') \
.replace('''//# sourceMappingURL=viewer.mjs.map''', '''''') \
.replace('''console.log(`PDF ${pdfDocument.''', '''// console.log(`PDF ${pdfDocument.''') \
.replace('''value: "../build/pdf.worker.mjs"''', '''value: "./build/pdf.worker.mjs"''') \
Expand All @@ -44,9 +44,9 @@
.replace('''setRotation(this.initialRotation);''', '''// setRotation(this.initialRotation);''') \
.replace('''this.pdfLinkService.setHash(this.initialBookmark);''', '''// this.pdfLinkService.setHash(this.initialBookmark);''') \
.replace('''hPadding = vPadding = 0;''', '''if (this._scrollMode === ScrollMode.HORIZONTAL || this._spreadMode === SpreadMode.NONE) { hPadding = vPadding = 0; } else { hPadding = 10; vPadding = 0; }''') \
.replace('''eventBus._on("openfile"''', '''// eventBus._on("openfile"''') \
.replace('''eventBus._on("print"''', '''// eventBus._on("print"''') \
.replace('''eventBus._on("download"''', '''// eventBus._on("download"''')
.replace(''' eventBus._on("openfile"''', ''' // eventBus._on("openfile"''') \
.replace(''' eventBus._on("print"''', ''' // eventBus._on("print"''') \
.replace(''' eventBus._on("download"''', ''' // eventBus._on("download"''')
fout.write(line)

os.system(f'git diff --no-index {args.web}/viewer.html {args.viewer}/viewer.html > {args.viewer}/../dev/viewer/viewer.html.diff')
Expand Down
2 changes: 1 addition & 1 deletion dev/viewer/viewer.html.diff
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/../../web/viewer.html b/../viewer/viewer.html
index c4829f2c4..8932bbc8a 100644
index 30182ef5e..8c8db6716 100644
--- a/../../web/viewer.html
+++ b/../viewer/viewer.html
@@ -25,15 +25,17 @@ See https://github.com/adobe-type-tools/cmap-resources
Expand Down
54 changes: 37 additions & 17 deletions dev/viewer/viewer.mjs.diff
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/../../web/viewer.mjs b/../viewer/viewer.mjs
index b3d3e62a3..da9717dc3 100644
index c3d794a27..085275c56 100644
--- a/../../web/viewer.mjs
+++ b/../viewer/viewer.mjs
@@ -758,7 +758,7 @@ const defaultOptions = {
Expand Down Expand Up @@ -38,7 +38,7 @@ index b3d3e62a3..da9717dc3 100644
kind: OptionKind.VIEWER
};
defaultOptions.viewerCssTheme = {
@@ -2615,7 +2615,7 @@ class Localization {
@@ -2616,7 +2616,7 @@ class Localization {
if (typeof console !== "undefined") {
const locale = bundle.locales[0];
const ids = Array.from(missingIds).join(", ");
Expand All @@ -47,7 +47,7 @@ index b3d3e62a3..da9717dc3 100644
}
}
if (!hasAtLeastOneBundle && typeof console !== "undefined") {
@@ -3098,11 +3098,11 @@ class GenericScripting {
@@ -3099,11 +3099,11 @@ class GenericScripting {
function initCom(app) {}
class Preferences extends BasePreferences {
async _writeToStorage(prefObj) {
Expand All @@ -61,7 +61,7 @@ index b3d3e62a3..da9717dc3 100644
};
}
}
@@ -5183,7 +5183,7 @@ const FindState = {
@@ -5273,7 +5273,7 @@ const FindState = {
PENDING: 3
};
const FIND_TIMEOUT = 250;
Expand All @@ -70,7 +70,7 @@ index b3d3e62a3..da9717dc3 100644
const MATCH_SCROLL_OFFSET_LEFT = -400;
const CHARACTERS_TO_NORMALIZE = {
"\u2010": "-",
@@ -7590,6 +7590,9 @@ function renderProgress(index, total) {
@@ -7681,6 +7681,9 @@ function renderProgress(index, total) {
}
window.addEventListener("keydown", function (event) {
if (event.keyCode === 80 && (event.ctrlKey || event.metaKey) && !event.altKey && (!event.shiftKey || window.chrome || window.opera)) {
Expand All @@ -80,7 +80,7 @@ index b3d3e62a3..da9717dc3 100644
window.print();
event.preventDefault();
event.stopImmediatePropagation();
@@ -8174,7 +8177,7 @@ class PDFSidebar {
@@ -8265,7 +8268,7 @@ class PDFSidebar {
this.#dispatchEvent();
return;
}
Expand All @@ -89,7 +89,7 @@ index b3d3e62a3..da9717dc3 100644
if (!this.isInitialEventDispatched) {
this.#dispatchEvent();
}
@@ -10895,7 +10898,7 @@ class PDFViewer {
@@ -10995,7 +10998,7 @@ class PDFViewer {
this.#enableNewAltTextWhenAddingImage = options.enableNewAltTextWhenAddingImage === true;
this.imageResourcesPath = options.imageResourcesPath || "";
this.enablePrintAutoRotate = options.enablePrintAutoRotate || false;
Expand All @@ -98,7 +98,7 @@ index b3d3e62a3..da9717dc3 100644
this.maxCanvasPixels = options.maxCanvasPixels;
this.l10n = options.l10n;
this.l10n ||= new genericl10n_GenericL10n();
@@ -11631,12 +11634,12 @@ class PDFViewer {
@@ -11732,12 +11735,12 @@ class PDFViewer {
hPadding *= 2;
}
} else if (this.removePageBorders) {
Expand All @@ -114,7 +114,7 @@ index b3d3e62a3..da9717dc3 100644
switch (value) {
case "page-actual":
scale = 1;
@@ -11747,7 +11750,7 @@ class PDFViewer {
@@ -11848,7 +11851,7 @@ class PDFViewer {
let hPadding = SCROLLBAR_PADDING,
vPadding = VERTICAL_PADDING;
if (this.removePageBorders) {
Expand All @@ -123,7 +123,7 @@ index b3d3e62a3..da9717dc3 100644
}
widthScale = (this.container.clientWidth - hPadding) / width / PixelsPerInch.PDF_TO_CSS_UNITS;
heightScale = (this.container.clientHeight - vPadding) / height / PixelsPerInch.PDF_TO_CSS_UNITS;
@@ -12987,10 +12990,10 @@ class ViewHistory {
@@ -13088,10 +13091,10 @@ class ViewHistory {
}
async _writeToStorage() {
const databaseStr = JSON.stringify(this.database);
Expand All @@ -136,7 +136,7 @@ index b3d3e62a3..da9717dc3 100644
}
async set(name, val) {
await this._initializedPromise;
@@ -13574,7 +13577,7 @@ const PDFViewerApplication = {
@@ -13694,7 +13697,7 @@ const PDFViewerApplication = {
title = decodeURIComponent(getFilenameFromUrl(url));
} catch {}
}
Expand All @@ -145,7 +145,7 @@ index b3d3e62a3..da9717dc3 100644
},
setTitle(title = this._title) {
this._title = title;
@@ -13998,7 +14001,7 @@ const PDFViewerApplication = {
@@ -14118,7 +14121,7 @@ const PDFViewerApplication = {
this.metadata = metadata;
this._contentDispositionFilename ??= contentDispositionFilename;
this._contentLength ??= contentLength;
Expand All @@ -154,7 +154,7 @@ index b3d3e62a3..da9717dc3 100644
let pdfTitle = info.Title;
const metadataTitle = metadata?.get("dc:title");
if (metadataTitle) {
@@ -14129,9 +14132,9 @@ const PDFViewerApplication = {
@@ -14249,9 +14252,9 @@ const PDFViewerApplication = {
this.pdfSidebar?.setInitialView(sidebarView);
setViewerModes(scrollMode, spreadMode);
if (this.initialBookmark) {
Expand All @@ -166,16 +166,36 @@ index b3d3e62a3..da9717dc3 100644
this.initialBookmark = null;
} else if (storedHash) {
setRotation(rotation);
@@ -15290,7 +15293,7 @@ function webViewerLoad() {
@@ -14368,8 +14371,8 @@ const PDFViewerApplication = {
eventBus._on("presentationmodechanged", evt => pdfViewer.presentationModeState = evt.state, opts);
eventBus._on("presentationmode", this.requestPresentationMode.bind(this), opts);
eventBus._on("switchannotationeditormode", evt => pdfViewer.annotationEditorMode = evt, opts);
- eventBus._on("print", this.triggerPrinting.bind(this), opts);
- eventBus._on("download", this.downloadOrSave.bind(this), opts);
+ // eventBus._on("print", this.triggerPrinting.bind(this), opts);
+ // eventBus._on("download", this.downloadOrSave.bind(this), opts);
eventBus._on("firstpage", () => this.page = 1, opts);
eventBus._on("lastpage", () => this.page = this.pagesCount, opts);
eventBus._on("nextpage", () => pdfViewer.nextPage(), opts);
@@ -14392,7 +14395,7 @@ const PDFViewerApplication = {
eventBus._on("updatefindmatchescount", onUpdateFindMatchesCount.bind(this), opts);
eventBus._on("updatefindcontrolstate", onUpdateFindControlState.bind(this), opts);
eventBus._on("fileinputchange", onFileInputChange.bind(this), opts);
- eventBus._on("openfile", onOpenFile.bind(this), opts);
+ // eventBus._on("openfile", onOpenFile.bind(this), opts);
},
bindWindowEvents() {
if (this._windowAbortController) {
@@ -15345,7 +15348,7 @@ function webViewerLoad() {
try {
parent.document.dispatchEvent(event);
} catch (ex) {
- console.error(`webviewerloaded: ${ex}`);
+ // console.error(`webviewerloaded: ${ex}`);
- console.error("webviewerloaded:", ex);
+ // console.error("webviewerloaded:", ex);
document.dispatchEvent(event);
}
PDFViewerApplication.run(config);
@@ -15307,4 +15310,3 @@ var __webpack_exports__PDFViewerApplicationConstants = __webpack_exports__.PDFVi
@@ -15362,4 +15365,3 @@ var __webpack_exports__PDFViewerApplicationConstants = __webpack_exports__.PDFVi
var __webpack_exports__PDFViewerApplicationOptions = __webpack_exports__.PDFViewerApplicationOptions;
export { __webpack_exports__PDFViewerApplication as PDFViewerApplication, __webpack_exports__PDFViewerApplicationConstants as PDFViewerApplicationConstants, __webpack_exports__PDFViewerApplicationOptions as PDFViewerApplicationOptions };

Expand Down
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2667,7 +2667,7 @@
"latex-utensils": "^6.2.0",
"mathjax-full": "^3.2.2",
"micromatch": "^4.0.8",
"pdfjs-dist": "4.9.124",
"pdfjs-dist": "4.10.38",
"tmp": "^0.2.3",
"workerpool": "^9.1.3",
"ws": "^8.18.0"
Expand Down
21 changes: 21 additions & 0 deletions viewer/locale/be/viewer.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -495,3 +495,24 @@ pdfjs-editor-alt-text-settings-editor-title = Рэдактар тэксту дл
pdfjs-editor-alt-text-settings-show-dialog-button-label = Адразу паказваць рэдактар тэксту для атрыбута alt пры даданні выявы
pdfjs-editor-alt-text-settings-show-dialog-description = Дапамагае пераканацца, што ўсе вашы выявы маюць альтэрнатыўны тэкст.
pdfjs-editor-alt-text-settings-close-button = Закрыць
## "Annotations removed" bar

pdfjs-editor-undo-bar-message-highlight = Падсвятленне выдалена
pdfjs-editor-undo-bar-message-freetext = Тэкст выдалены
pdfjs-editor-undo-bar-message-ink = Малюнак выдалены
pdfjs-editor-undo-bar-message-stamp = Відарыс выдалены
# Variables:
# $count (Number) - the number of removed annotations.
pdfjs-editor-undo-bar-message-multiple =
{ $count ->
[one] { $count } анатацыя выдалена
[few] { $count } анатацыі выдалена
*[many] { $count } анатацый выдалена
}
pdfjs-editor-undo-bar-undo-button =
.title = Адмяніць
pdfjs-editor-undo-bar-undo-button-label = Адмяніць
pdfjs-editor-undo-bar-close-button =
.title = Закрыць
pdfjs-editor-undo-bar-close-button-label = Закрыць
22 changes: 22 additions & 0 deletions viewer/locale/cs/viewer.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -497,3 +497,25 @@ pdfjs-editor-alt-text-settings-editor-title = Editor alternativního textu
pdfjs-editor-alt-text-settings-show-dialog-button-label = Při přidávání obrázku hned zobrazit editor alternativního textu
pdfjs-editor-alt-text-settings-show-dialog-description = Pomůže vám zajistit, aby všechny vaše obrázky obsahovaly alternativní text.
pdfjs-editor-alt-text-settings-close-button = Zavřít
## "Annotations removed" bar

pdfjs-editor-undo-bar-message-highlight = Zvýraznění odebráno
pdfjs-editor-undo-bar-message-freetext = Text odstraněn
pdfjs-editor-undo-bar-message-ink = Kresba odstraněna
pdfjs-editor-undo-bar-message-stamp = Obrázek odebrán
# Variables:
# $count (Number) - the number of removed annotations.
pdfjs-editor-undo-bar-message-multiple =
{ $count ->
[one] { $count } anotace odebrána
[few] { $count } anotace odebrány
[many] { $count } anotací odebráno
*[other] { $count } anotací odebráno
}
pdfjs-editor-undo-bar-undo-button =
.title = Zpět
pdfjs-editor-undo-bar-undo-button-label = Zpět
pdfjs-editor-undo-bar-close-button =
.title = Zavřít
pdfjs-editor-undo-bar-close-button-label = Zavřít
26 changes: 25 additions & 1 deletion viewer/locale/cy/viewer.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ pdfjs-editor-new-alt-text-textarea =
pdfjs-editor-new-alt-text-description = Disgrifiad byr ar gyfer pobl sydd ddim yn gallu gweld y ddelwedd neu pan nad yw'r ddelwedd yn llwytho.
# This is a required legal disclaimer that refers to the automatically created text inside the alt text box above this text. It disappears if the text is edited by a human.
pdfjs-editor-new-alt-text-disclaimer1 = Cafodd y testun amgen hwn ei greu'n awtomatig a gall fod yn anghywir.
pdfjs-editor-new-alt-text-disclaimer-learn-more-url = Dysgu rhagor
pdfjs-editor-new-alt-text-disclaimer-learn-more-url = Rhagor
pdfjs-editor-new-alt-text-create-automatically-button-label = Creu testun amgen yn awtomatig
pdfjs-editor-new-alt-text-not-now-button = Nid nawr
pdfjs-editor-new-alt-text-error-title = Methu â chreu testun amgen yn awtomatig
Expand Down Expand Up @@ -501,3 +501,27 @@ pdfjs-editor-alt-text-settings-editor-title = Golygydd testun amgen
pdfjs-editor-alt-text-settings-show-dialog-button-label = Dangoswch y golygydd testun amgen yn syth wrth ychwanegu delwedd
pdfjs-editor-alt-text-settings-show-dialog-description = Yn eich helpu i wneud yn siŵr bod gan eich holl ddelweddau destun amgen.
pdfjs-editor-alt-text-settings-close-button = Cau
## "Annotations removed" bar

pdfjs-editor-undo-bar-message-highlight = Tynnwyd yr amlygu
pdfjs-editor-undo-bar-message-freetext = Tynnwyd y testun
pdfjs-editor-undo-bar-message-ink = Tynnwyd y lluniad
pdfjs-editor-undo-bar-message-stamp = Tynnwyd y ddelwedd
# Variables:
# $count (Number) - the number of removed annotations.
pdfjs-editor-undo-bar-message-multiple =
{ $count ->
[zero] { $count } anodiad wedi'u tynnu
[one] { $count } anodiad wedi'i dynnu
[two] { $count } anodiad wedi'u tynnu
[few] { $count } anodiad wedi'u tynnu
[many] { $count } anodiad wedi'u tynnu
*[other] { $count } anodiad wedi'u tynnu
}
pdfjs-editor-undo-bar-undo-button =
.title = Dadwneud
pdfjs-editor-undo-bar-undo-button-label = Dadwneud
pdfjs-editor-undo-bar-close-button =
.title = Cau
pdfjs-editor-undo-bar-close-button-label = Cau
20 changes: 20 additions & 0 deletions viewer/locale/da/viewer.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -493,3 +493,23 @@ pdfjs-editor-alt-text-settings-editor-title = Redigering af alternativ tekst
pdfjs-editor-alt-text-settings-show-dialog-button-label = Vis redigering af alternativ tekst med det samme, når et billede tilføjes
pdfjs-editor-alt-text-settings-show-dialog-description = Hjælper dig med at sikre, at alle dine billeder har alternativ tekst.
pdfjs-editor-alt-text-settings-close-button = Luk
## "Annotations removed" bar

pdfjs-editor-undo-bar-message-highlight = Fremhævning fjernet
pdfjs-editor-undo-bar-message-freetext = Tekst fjernet
pdfjs-editor-undo-bar-message-ink = Tegning fjernet
pdfjs-editor-undo-bar-message-stamp = Billede fjernet
# Variables:
# $count (Number) - the number of removed annotations.
pdfjs-editor-undo-bar-message-multiple =
{ $count ->
[one] { $count } kommentar fjernet
*[other] { $count } kommentarer fjernet
}
pdfjs-editor-undo-bar-undo-button =
.title = Fortryd
pdfjs-editor-undo-bar-undo-button-label = Fortryd
pdfjs-editor-undo-bar-close-button =
.title = Luk
pdfjs-editor-undo-bar-close-button-label = Luk
20 changes: 20 additions & 0 deletions viewer/locale/de/viewer.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -493,3 +493,23 @@ pdfjs-editor-alt-text-settings-editor-title = Alternativ-Texteditor
pdfjs-editor-alt-text-settings-show-dialog-button-label = Alternativ-Texteditor beim Hinzufügen einer Grafik anzeigen
pdfjs-editor-alt-text-settings-show-dialog-description = Hilft Ihnen, sicherzustellen, dass alle Ihre Grafiken Alternativ-Text haben.
pdfjs-editor-alt-text-settings-close-button = Schließen
## "Annotations removed" bar

pdfjs-editor-undo-bar-message-highlight = Hervorhebung entfernt
pdfjs-editor-undo-bar-message-freetext = Text entfernt
pdfjs-editor-undo-bar-message-ink = Zeichnung entfernt
pdfjs-editor-undo-bar-message-stamp = Grafik entfernt
# Variables:
# $count (Number) - the number of removed annotations.
pdfjs-editor-undo-bar-message-multiple =
{ $count ->
[one] { $count } Anmerkung entfernt
*[other] { $count } Anmerkungen entfernt
}
pdfjs-editor-undo-bar-undo-button =
.title = Rückgängig
pdfjs-editor-undo-bar-undo-button-label = Rückgängig
pdfjs-editor-undo-bar-close-button =
.title = Schließen
pdfjs-editor-undo-bar-close-button-label = Schließen
22 changes: 22 additions & 0 deletions viewer/locale/dsb/viewer.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -497,3 +497,25 @@ pdfjs-editor-alt-text-settings-editor-title = Editor za alternatiwny tekst
pdfjs-editor-alt-text-settings-show-dialog-button-label = Editor alternatiwnego teksta ned pokazaś, gaž se wobraz pśidawa
pdfjs-editor-alt-text-settings-show-dialog-description = Pomaga, wam wšym swójim wobrazam alternatiwny tekst pśidaś.
pdfjs-editor-alt-text-settings-close-button = Zacyniś
## "Annotations removed" bar

pdfjs-editor-undo-bar-message-highlight = Wótwónoźone wuzwignuś
pdfjs-editor-undo-bar-message-freetext = Tekst jo se wótwónoźeł
pdfjs-editor-undo-bar-message-ink = Kreslanka jo se wótwónoźeła
pdfjs-editor-undo-bar-message-stamp = Wobraz jo se wótwónoźeł
# Variables:
# $count (Number) - the number of removed annotations.
pdfjs-editor-undo-bar-message-multiple =
{ $count ->
[one] { $count } pśipisk jo se wótwónoźeł
[two] { $count } pśipiska stej se wótwónoźełej
[few] { $count } pśipiski su se wótwónoźeli
*[other] { $count } pśipiskow jo se wótwónoźeło
}
pdfjs-editor-undo-bar-undo-button =
.title = Anulěrowaś
pdfjs-editor-undo-bar-undo-button-label = Anulěrowaś
pdfjs-editor-undo-bar-close-button =
.title = Zacyniś
pdfjs-editor-undo-bar-close-button-label = Zacyniś
Loading

0 comments on commit ed5efd9

Please sign in to comment.