Skip to content

Commit

Permalink
Update pdf.js
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenjoezhang committed Dec 12, 2021
1 parent 41f54f6 commit 05456c9
Show file tree
Hide file tree
Showing 13 changed files with 163 additions and 124 deletions.
51 changes: 20 additions & 31 deletions build/pdf.js

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

2 changes: 1 addition & 1 deletion build/pdf.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions build/pdf.sandbox.js

Large diffs are not rendered by default.

57 changes: 36 additions & 21 deletions build/pdf.worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -4825,7 +4825,7 @@ class PDFDocument {
await this.getPage(0);
} catch (reason) {
if (reason instanceof _core_utils.XRefEntryException) {
this._pagePromises.clear();
this._pagePromises.delete(0);

await this.cleanup();
throw new _core_utils.XRefParseException();
Expand Down Expand Up @@ -4860,17 +4860,22 @@ class PDFDocument {

await this.getPage(numPages - 1);
} catch (reason) {
(0, _util.warn)(`checkLastPage - invalid /Pages tree /Count: ${numPages}.`);
this._pagePromises.delete(numPages - 1);

await this.cleanup();

if (reason instanceof _core_utils.XRefEntryException && !recoveryMode) {
throw new _core_utils.XRefParseException();
}

(0, _util.warn)(`checkLastPage - invalid /Pages tree /Count: ${numPages}.`);
let pagesTree;

try {
pagesTree = await pdfManager.ensureCatalog("getAllPageDicts");
pagesTree = await pdfManager.ensureCatalog("getAllPageDicts", [recoveryMode]);
} catch (reasonAll) {
if (reasonAll instanceof _core_utils.XRefEntryException) {
if (!recoveryMode) {
throw new _core_utils.XRefParseException();
}
if (reasonAll instanceof _core_utils.XRefEntryException && !recoveryMode) {
throw new _core_utils.XRefParseException();
}

catalog.setActualNumPages(1);
Expand Down Expand Up @@ -29315,6 +29320,10 @@ class CCITTFaxDecoder {
c = 0;

do {
if (typeof this.outputBits !== "number") {
throw new _util.FormatError('Invalid /CCITTFaxDecode data, "outputBits" must be a number.');
}

if (this.outputBits > bits) {
c <<= bits;

Expand Down Expand Up @@ -54089,7 +54098,7 @@ class Catalog {
if ((0, _primitives.isRef)(currentNode)) {
const count = pageKidsCountCache.get(currentNode);

if (count > 0 && currentPageIndex + count < pageIndex) {
if (count >= 0 && currentPageIndex + count <= pageIndex) {
currentPageIndex += count;
continue;
}
Expand All @@ -54102,11 +54111,11 @@ class Catalog {
visitedNodes.put(currentNode);
xref.fetchAsync(currentNode).then(function (obj) {
if ((0, _primitives.isDict)(obj, "Page") || (0, _primitives.isDict)(obj) && !obj.has("Kids")) {
if (pageIndex === currentPageIndex) {
if (currentNode && !pageKidsCountCache.has(currentNode)) {
pageKidsCountCache.put(currentNode, 1);
}
if (currentNode && !pageKidsCountCache.has(currentNode)) {
pageKidsCountCache.put(currentNode, 1);
}

if (pageIndex === currentPageIndex) {
capability.resolve([obj, currentNode]);
} else {
currentPageIndex++;
Expand Down Expand Up @@ -54197,7 +54206,7 @@ class Catalog {
return capability.promise;
}

getAllPageDicts() {
getAllPageDicts(recoveryMode = false) {
const queue = [{
currentNode: this.toplevelPagesDict,
posInKids: 0
Expand All @@ -54210,8 +54219,8 @@ class Catalog {
map.set(pageIndex++, [pageDict, pageRef]);
}

function addPageError(msg) {
map.set(pageIndex++, [new _util.FormatError(msg), null]);
function addPageError(error) {
map.set(pageIndex++, [error, null]);
}

while (queue.length > 0) {
Expand All @@ -54229,13 +54238,16 @@ class Catalog {
throw ex;
}

if (ex instanceof _core_utils.XRefEntryException) {
if (ex instanceof _core_utils.XRefEntryException && !recoveryMode) {
throw ex;
}

addPageError(ex);
break;
}

if (!Array.isArray(kids)) {
addPageError("Page dictionary kids object is not an array.");
addPageError(new _util.FormatError("Page dictionary kids object is not an array."));
break;
}

Expand All @@ -54255,13 +54267,16 @@ class Catalog {
throw ex;
}

if (ex instanceof _core_utils.XRefEntryException) {
if (ex instanceof _core_utils.XRefEntryException && !recoveryMode) {
throw ex;
}

addPageError(ex);
break;
}

if (visitedNodes.has(kidObj)) {
addPageError("Pages tree contains circular reference.");
addPageError(new _util.FormatError("Pages tree contains circular reference."));
break;
}

Expand All @@ -54271,7 +54286,7 @@ class Catalog {
}

if (!(obj instanceof _primitives.Dict)) {
addPageError("Page dictionary kid reference points to wrong type of object.");
addPageError(new _util.FormatError("Page dictionary kid reference points to wrong type of object."));
break;
}

Expand Down Expand Up @@ -73521,7 +73536,7 @@ Object.defineProperty(exports, "WorkerMessageHandler", ({
var _worker = __w_pdfjs_require__(1);

const pdfjsVersion = '2.12.0';
const pdfjsBuild = 'dc455c8';
const pdfjsBuild = '6d8d37e';
})();

/******/ return __webpack_exports__;
Expand Down
2 changes: 1 addition & 1 deletion build/pdf.worker.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions web/locale/eo/viewer.properties
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ cursor_text_select_tool_label=Teksta elektilo
cursor_hand_tool.title=Aktivigi ilon de mano
cursor_hand_tool_label=Ilo de mano

scroll_page.title=Uzi ŝovadon de paĝo
scroll_page_label=Ŝovado de paĝo
scroll_vertical.title=Uzi vertikalan ŝovadon
scroll_vertical_label=Vertikala ŝovado
scroll_horizontal.title=Uzi horizontalan ŝovadon
Expand Down
12 changes: 12 additions & 0 deletions web/locale/et/viewer.properties
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ cursor_text_select_tool_label=Teksti valimise tööriist
cursor_hand_tool.title=Luba sirvimistööriist
cursor_hand_tool_label=Sirvimistööriist

scroll_page.title=Kasutatakse lehe kaupa kerimist
scroll_page_label=Lehe kaupa kerimine
scroll_vertical.title=Kasuta vertikaalset kerimist
scroll_vertical_label=Vertikaalne kerimine
scroll_horizontal.title=Kasuta horisontaalset kerimist
Expand Down Expand Up @@ -133,16 +135,24 @@ print_progress_close=Loobu
# (the _label strings are alt text for the buttons, the .title strings are
# tooltips)
toggle_sidebar.title=Näita külgriba
toggle_sidebar_notification2.title=Näita külgriba (dokument sisaldab sisukorda/manuseid/kihte)
toggle_sidebar_label=Näita külgriba
document_outline.title=Näita sisukorda (kõigi punktide laiendamiseks/ahendamiseks topeltklõpsa)
document_outline_label=Näita sisukorda
attachments.title=Näita manuseid
attachments_label=Manused
layers.title=Näita kihte (kõikide kihtide vaikeolekusse lähtestamiseks topeltklõpsa)
layers_label=Kihid
thumbs.title=Näita pisipilte
thumbs_label=Pisipildid
current_outline_item.title=Otsi üles praegune kontuuriüksus
current_outline_item_label=Praegune kontuuriüksus
findbar.title=Otsi dokumendist
findbar_label=Otsi

additional_layers=Täiendavad kihid
# LOCALIZATION NOTE (page_landmark): "{{page}}" will be replaced by the page number.
page_landmark=Lehekülg {{page}}
# Thumbnails panel item (tooltip and alt text for images)
# LOCALIZATION NOTE (thumb_page_title): "{{page}}" will be replaced by the page
# number.
Expand Down Expand Up @@ -214,6 +224,8 @@ page_scale_actual=Tegelik suurus
# numerical scale value.
page_scale_percent={{scale}}%

# Loading indicator messages
loading=Laadimine…
loading_error=PDFi laadimisel esines viga.
invalid_file_error=Vigane või rikutud PDF-fail.
missing_file_error=PDF-fail puudub.
Expand Down
1 change: 1 addition & 0 deletions web/locale/nn-NO/viewer.properties
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ cursor_text_select_tool_label=Tekstmarkeringsverktøy
cursor_hand_tool.title=Aktiver handverktøy
cursor_hand_tool_label=Handverktøy

scroll_page.title=Bruk siderulling
scroll_page_label=Siderulling
scroll_vertical.title=Bruk vertikal rulling
scroll_vertical_label=Vertikal rulling
Expand Down
2 changes: 2 additions & 0 deletions web/locale/pl/viewer.properties
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ cursor_text_select_tool_label=Narzędzie zaznaczania tekstu
cursor_hand_tool.title=Włącz narzędzie rączka
cursor_hand_tool_label=Narzędzie rączka

scroll_page.title=Przewijaj strony
scroll_page_label=Przewijanie stron
scroll_vertical.title=Przewijaj dokument w pionie
scroll_vertical_label=Przewijanie pionowe
scroll_horizontal.title=Przewijaj dokument w poziomie
Expand Down
2 changes: 1 addition & 1 deletion web/locale/vi/viewer.properties
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ print_progress_close=Hủy bỏ
toggle_sidebar.title=Bật/Tắt thanh lề
toggle_sidebar_notification2.title=Bật tắt thanh lề (tài liệu bao gồm bản phác thảo/tập tin đính kèm/lớp)
toggle_sidebar_label=Bật/Tắt thanh lề
document_outline.title=Hiện tài liệu phác thảo (nhấp đúp vào để mở rộng/thu gọn tất cả các mục)
document_outline.title=Hiển thị tài liệu phác thảo (nhấp đúp vào để mở rộng/thu gọn tất cả các mục)
document_outline_label=Bản phác tài liệu
attachments.title=Hiện nội dung đính kèm
attachments_label=Nội dung đính kèm
Expand Down
Loading

0 comments on commit 05456c9

Please sign in to comment.