Merge pull request #13383 from Snuffleupagus/update-packages

Update packages and translations
This commit is contained in:
Tim van der Meij 2021-05-16 13:04:16 +02:00 committed by GitHub
commit ab419cc320
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
44 changed files with 1062 additions and 675 deletions

View File

@ -32,7 +32,9 @@
"rules": {
// Plugins
"import/extensions": ["error", "always", { "ignorePackages": true, }],
"import/no-unresolved": "error",
"import/no-unresolved": ["error", {
"ignore": ["pdfjs", "pdfjs-lib", "pdfjs-web"]
}],
"mozilla/avoid-removeChild": "error",
"mozilla/use-includes-instead-of-indexOf": "error",
"no-unsanitized/method": "error",

View File

@ -122,7 +122,8 @@ function preprocess(inFilename, outFilename, defines) {
let line;
let state = STATE_NONE;
const stack = [];
const control = /^(?:\/\/|<!--)\s*#(if|elif|else|endif|expand|include|error)\b(?:\s+(.*?)(?:-->)?$)?/;
const control =
/^(?:\/\/|<!--)\s*#(if|elif|else|endif|expand|include|error)\b(?:\s+(.*?)(?:-->)?$)?/;
while ((line = readLine()) !== null) {
++lineNumber;

View File

@ -1,6 +1,6 @@
"use strict";
const builder = require("./builder");
const builder = require("./builder.js");
const fs = require("fs");
const path = require("path");

View File

@ -36,7 +36,8 @@ exports.parseAdobeCMap = function (content) {
if (m) {
result.usecmap = m[1];
}
const re = /(\d+)\s+(begincodespacerange|beginnotdefrange|begincidchar|begincidrange|beginbfchar|beginbfrange)\n([\s\S]*?)\n(endcodespacerange|endnotdefrange|endcidchar|endcidrange|endbfchar|endbfrange)/g;
const re =
/(\d+)\s+(begincodespacerange|beginnotdefrange|begincidchar|begincidrange|beginbfchar|beginbfrange)\n([\s\S]*?)\n(endcodespacerange|endnotdefrange|endcidchar|endcidrange|endbfchar|endbfrange)/g;
while ((m = re.exec(body))) {
const lines = m[3].toLowerCase().split("\n");

View File

@ -756,8 +756,8 @@ gulp.task("cmaps", function (done) {
}
});
const compressCmaps = require("./external/cmapscompress/compress.js")
.compressCmaps;
const compressCmaps =
require("./external/cmapscompress/compress.js").compressCmaps;
compressCmaps(CMAP_INPUT, VIEWER_CMAP_OUTPUT, true);
done();
});
@ -1415,7 +1415,8 @@ function buildLibHelper(bundleDefines, inputStream, outputDir) {
babelPluginReplaceNonWebPackRequire,
],
}).code;
const removeCjsSrc = /^(var\s+\w+\s*=\s*(_interopRequireDefault\()?require\(".*?)(?:\/src)(\/[^"]*"\)\)?;)$/gm;
const removeCjsSrc =
/^(var\s+\w+\s*=\s*(_interopRequireDefault\()?require\(".*?)(?:\/src)(\/[^"]*"\)\)?;)$/gm;
content = content.replace(removeCjsSrc, (all, prefix, interop, suffix) => {
return prefix + suffix;
});
@ -2176,9 +2177,8 @@ gulp.task(
let reason = process.env.PDFJS_UPDATE_REASON;
// Attempt to work-around the broken link, see https://github.com/mozilla/pdf.js/issues/10391
if (typeof reason === "string") {
const reasonParts = /^(See )(mozilla\/pdf\.js)@tags\/(v\d+\.\d+\.\d+)\s*$/.exec(
reason
);
const reasonParts =
/^(See )(mozilla\/pdf\.js)@tags\/(v\d+\.\d+\.\d+)\s*$/.exec(reason);
if (reasonParts) {
reason =

View File

@ -36,7 +36,9 @@ zoom.title=Zoom
presentation_mode.title=Cambiar al mou de presentación
presentation_mode_label=Mou de presentación
open_file_label=Abrir
print.title=Imprentar
print_label=Imprentar
download.title=Baxar
download_label=Baxar
bookmark_label=Vista actual

View File

@ -67,17 +67,17 @@ cursor_hand_tool_label=Offeryn Llaw
scroll_vertical.title=Defnyddio Sgrolio Fertigol
scroll_vertical_label=Sgrolio Fertigol
scroll_horizontal.title=Defnyddio Sgrolio Fertigol
scroll_horizontal_label=Sgrolio Fertigol
scroll_horizontal.title=Defnyddio Sgrolio Llorweddol
scroll_horizontal_label=Sgrolio Llorweddol
scroll_wrapped.title=Defnyddio Sgrolio Amlapio
scroll_wrapped_label=Sgrolio Amlapio
spread_none.title=Peidio uno taeniadau canol
spread_none_label=Dim Taeniadau
spread_odd.title=Uno taeniadau tudalen yn cychwyn gyda thudalennau odrif
spread_odd_label=Taeniadau Odrifau
spread_even.title=Uno taeniadau tudalen yn cychwyn gyda thudalennau eilrif
spread_even_label=Taeniadau Eilrif
spread_none.title=Peidio uno trawsdaleniadau
spread_none_label=Dim Trawsdaleniadau
spread_odd.title=Uno trawsdaleniadau gan gychwyn gyda thudalennau odrif
spread_odd_label=Trawsdaleniadau Odrif
spread_even.title=Uno trawsdaleniadau gan gychwyn gyda thudalennau eilrif
spread_even_label=Trawsdaleniadau Eilrif
# Document properties dialog box
document_properties.title=Priodweddau Dogfen…

View File

@ -256,3 +256,6 @@ password_cancel=Heja
printing_not_supported=Kyhyjerã: Ñembokuatia ndojokupytypái ko kundahára ndive.
printing_not_ready=Kyhyjerã: Ko PDF nahenyhẽmbái oñembokuatia hag̃uáicha.
web_fonts_disabled=Ñanduti taity oñemongéma: ndaikatumoãi eipuru PDF jehaiíva taity.
# LOCALIZATION NOTE (unsupported_feature_signatures): Should contain the same
# exact string as in the `chrome.properties` file.
unsupported_feature_signatures=Ko PDF kuatiaite oreko mboheraguapy ñandutigua. Noñemoneĩri ñemboheraguapy.

View File

@ -256,3 +256,6 @@ password_cancel=Odustani
printing_not_supported=Upozorenje: Ovaj preglednik ne podržava u potpunosti ispisivanje.
printing_not_ready=Upozorenje: PDF nije u potpunosti učitan za ispis.
web_fonts_disabled=Web fontovi su deaktivirani: nije moguće koristiti ugrađene PDF fontove.
# LOCALIZATION NOTE (unsupported_feature_signatures): Should contain the same
# exact string as in the `chrome.properties` file.
unsupported_feature_signatures=Ovaj PDF dokument sadrži digitalne potpise. Provjera potpisa nije podržana.

View File

@ -256,3 +256,6 @@ password_cancel=キャンセル
printing_not_supported=警告: このブラウザーでは印刷が完全にサポートされていません。
printing_not_ready=警告: PDF を印刷するための読み込みが終了していません。
web_fonts_disabled=ウェブフォントが無効になっています: 埋め込まれた PDF のフォントを使用できません。
# LOCALIZATION NOTE (unsupported_feature_signatures): Should contain the same
# exact string as in the `chrome.properties` file.
unsupported_feature_signatures=この PDF ドキュメントは、デジタル署名が含まれています。署名の検証はサポートされていません。

View File

@ -156,6 +156,8 @@ findbar_label=ძიება
additional_layers=დამატებითი ფენები
# LOCALIZATION NOTE (page_canvas): "{{page}}" will be replaced by the page number.
page_canvas=გვერდი {{page}}
# LOCALIZATION NOTE (page_landmark): "{{page}}" will be replaced by the page number.
page_landmark=გვერდი {{page}}
# Thumbnails panel item (tooltip and alt text for images)
# LOCALIZATION NOTE (thumb_page_title): "{{page}}" will be replaced by the page
# number.
@ -229,6 +231,9 @@ page_scale_percent={{scale}}%
# Loading indicator messages
loading_error_indicator=შეცდომა
# Loading indicator messages
loading=ჩატვირთვა…
loading_error=შეცდომა, PDF-ფაილის ჩატვირთვისას.
invalid_file_error=არამართებული ან დაზიანებული PDF-ფაილი.
missing_file_error=ნაკლული PDF-ფაილი.
@ -251,3 +256,6 @@ password_cancel=გაუქმება
printing_not_supported=გაფრთხილება: ამობეჭდვა ამ ბრაუზერში არაა სრულად მხარდაჭერილი.
printing_not_ready=გაფრთხილება: PDF სრულად ჩატვირთული არაა, ამობეჭდვის დასაწყებად.
web_fonts_disabled=ვებშრიფტები გამორთულია: ჩაშენებული PDF-შრიფტების გამოყენება ვერ ხერხდება.
# LOCALIZATION NOTE (unsupported_feature_signatures): Should contain the same
# exact string as in the `chrome.properties` file.
unsupported_feature_signatures=ეს PDF შეიცავს ციფრულ ხელმოწერებს. ხელმოწერების დამოწმება არაა მხარდაჭერილი.

View File

@ -256,3 +256,6 @@ password_cancel=Anuluj
printing_not_supported=Ostrzeżenie: drukowanie nie jest w pełni obsługiwane przez tę przeglądarkę.
printing_not_ready=Ostrzeżenie: dokument PDF nie jest całkowicie wczytany, więc nie można go wydrukować.
web_fonts_disabled=Czcionki sieciowe są wyłączone: nie można użyć osadzonych czcionek PDF.
# LOCALIZATION NOTE (unsupported_feature_signatures): Should contain the same
# exact string as in the `chrome.properties` file.
unsupported_feature_signatures=Ten dokument PDF zawiera podpisy cyfrowe. Weryfikacja podpisów nie jest obsługiwana.

115
l10n/sco/viewer.properties Normal file
View File

@ -0,0 +1,115 @@
# 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.
# Main toolbar buttons (tooltips and alt text for images)
# LOCALIZATION NOTE (page.title): The tooltip for the pageNumber input.
page.title=Page
# LOCALIZATION NOTE (of_pages): "{{pagesCount}}" will be replaced by a number
# representing the total number of pages in the document.
# LOCALIZATION NOTE (page_of_pages): "{{pageNumber}}" and "{{pagesCount}}"
# will be replaced by a number representing the currently visible page,
# respectively a number representing the total number of pages in the document.
print.title=Prent
print_label=Prent
# Secondary toolbar and context menu
# Document properties dialog box
# LOCALIZATION NOTE (document_properties_kb): "{{size_kb}}" and "{{size_b}}"
# will be replaced by the PDF file size in kilobytes, respectively in bytes.
document_properties_kb={{size_kb}} KB ({{size_b}} bytes)
# LOCALIZATION NOTE (document_properties_mb): "{{size_mb}}" and "{{size_b}}"
# will be replaced by the PDF file size in megabytes, respectively in bytes.
document_properties_mb={{size_mb}} MB ({{size_b}} bytes)
# LOCALIZATION NOTE (document_properties_date_string): "{{date}}" and "{{time}}"
# will be replaced by the creation/modification date, and time, of the PDF file.
document_properties_date_string={{date}}, {{time}}
# LOCALIZATION NOTE (document_properties_page_size_dimension_string):
# "{{width}}", "{{height}}", {{unit}}, and {{orientation}} will be replaced by
# the size, respectively their unit of measurement and orientation, of the (current) page.
document_properties_page_size_dimension_string={{width}} × {{height}} {{unit}} ({{orientation}})
# LOCALIZATION NOTE (document_properties_page_size_dimension_name_string):
# "{{width}}", "{{height}}", {{unit}}, {{name}}, and {{orientation}} will be replaced by
# the size, respectively their unit of measurement, name, and orientation, of the (current) page.
document_properties_page_size_dimension_name_string={{width}} × {{height}} {{unit}} ({{name}}, {{orientation}})
# LOCALIZATION NOTE (document_properties_linearized): The linearization status of
# the document; usually called "Fast Web View" in English locales of Adobe software.
document_properties_close=Sneck
# LOCALIZATION NOTE (print_progress_percent): "{{progress}}" will be replaced by
# a numerical per cent value.
print_progress_percent={{progress}}%
# Tooltips and alt text for side panel toolbar buttons
# (the _label strings are alt text for the buttons, the .title strings are
# tooltips)
# LOCALIZATION NOTE (page_canvas): "{{page}}" will be replaced by the page number.
page_canvas=Page {{page}}
# LOCALIZATION NOTE (page_landmark): "{{page}}" will be replaced by the page number.
page_landmark=Page {{page}}
# Thumbnails panel item (tooltip and alt text for images)
# LOCALIZATION NOTE (thumb_page_title): "{{page}}" will be replaced by the page
# number.
thumb_page_title=Page {{page}}
# LOCALIZATION NOTE (thumb_page_canvas): "{{page}}" will be replaced by the page
# number.
# Find panel button title and messages
# LOCALIZATION NOTE (find_match_count): The supported plural forms are
# [one|two|few|many|other], with [other] as the default value.
# "{{current}}" and "{{total}}" will be replaced by a number representing the
# index of the currently active find result, respectively a number representing
# the total number of matches in the document.
# LOCALIZATION NOTE (find_match_count_limit): The supported plural forms are
# [zero|one|two|few|many|other], with [other] as the default value.
# "{{limit}}" will be replaced by a numerical value.
# Error panel labels
error_more_info=Mair Information
error_close=Sneck
# LOCALIZATION NOTE (error_version_info): "{{version}}" and "{{build}}" will be
# replaced by the PDF.JS version and build ID.
# LOCALIZATION NOTE (error_message): "{{message}}" will be replaced by an
# english string describing the error.
# LOCALIZATION NOTE (error_stack): "{{stack}}" will be replaced with a stack
# trace.
# LOCALIZATION NOTE (error_file): "{{file}}" will be replaced with a filename
# LOCALIZATION NOTE (error_line): "{{line}}" will be replaced with a line number
# Predefined zoom values
# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a
# numerical scale value.
page_scale_percent={{scale}}%
# Loading indicator messages
# Loading indicator messages
# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be
# replaced by the modification date, and time, of the annotation.
annotation_date_string={{date}}, {{time}}
# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.
# "{{type}}" will be replaced with an annotation type from a list defined in
# the PDF spec (32000-1:2008 Table 169 Annotation types).
# Some common types are e.g.: "Check", "Text", "Comment", "Note"
# LOCALIZATION NOTE (unsupported_feature_signatures): Should contain the same
# exact string as in the `chrome.properties` file.

View File

@ -154,6 +154,7 @@ findbar_label=Znojdź
additional_layers=Nadbytnie warstwy
# LOCALIZATION NOTE (page_canvas): "{{page}}" will be replaced by the page number.
page_canvas=Strōna {{page}}
# LOCALIZATION NOTE (page_landmark): "{{page}}" will be replaced by the page number.
# Thumbnails panel item (tooltip and alt text for images)
# LOCALIZATION NOTE (thumb_page_title): "{{page}}" will be replaced by the page
# number.
@ -169,7 +170,7 @@ find_previous.title=Znojdź piyrwyjsze pokozanie sie tyj frazy
find_previous_label=Piyrwyjszo
find_next.title=Znojdź nastympne pokozanie sie tyj frazy
find_next_label=Dalij
find_highlight=Ôbznocz wszysko
find_highlight=Zaznacz wszysko
find_match_case_label=Poznowej srogość liter
find_entire_word_label=Cołke słowa
find_reached_top=Doszło do samego wiyrchu strōny, dalij ôd spodku
@ -227,6 +228,8 @@ page_scale_percent={{scale}}%
# Loading indicator messages
loading_error_indicator=Feler
# Loading indicator messages
loading_error=Przi ladowaniu PDFa pokozoł sie feler.
invalid_file_error=Zły abo felerny zbiōr PDF.
missing_file_error=Chybio zbioru PDF.
@ -249,3 +252,5 @@ password_cancel=Pociep
printing_not_supported=Pozōr: Ta przeglōndarka niy cołkiym ôbsuguje durk.
printing_not_ready=Pozōr: Tyn PDF niy ma za tela zaladowany do durku.
web_fonts_disabled=Necowe fōnty sōm zastawiōne: niy idzie użyć wkludzōnych fōntōw PDF.
# LOCALIZATION NOTE (unsupported_feature_signatures): Should contain the same
# exact string as in the `chrome.properties` file.

View File

@ -29,6 +29,8 @@ zoom_in_label=Калон кардан
zoom.title=Танзими андоза
open_file.title=Кушодани файл
open_file_label=Кушодан
print.title=Чоп кардан
print_label=Чоп кардан
download.title=Боргирӣ кардан
download_label=Боргирӣ кардан
bookmark.title=Намуди ҷорӣ (нусха бардоштан ё кушодан дар равзанаи нав)
@ -66,8 +68,10 @@ document_properties_page_size_dimension_name_string={{width}} × {{height}} {{un
# LOCALIZATION NOTE (document_properties_linearized): The linearization status of
# the document; usually called "Fast Web View" in English locales of Adobe software.
print_progress_message=Омодасозии ҳуҷҷат барои чоп…
# LOCALIZATION NOTE (print_progress_percent): "{{progress}}" will be replaced by
# a numerical per cent value.
print_progress_percent={{progress}}%
print_progress_close=Бекор кардан
# Tooltips and alt text for side panel toolbar buttons

View File

@ -256,3 +256,6 @@ password_cancel=ยกเลิก
printing_not_supported=คำเตือน: เบราว์เซอร์นี้ไม่ได้สนับสนุนการพิมพ์อย่างเต็มที่
printing_not_ready=คำเตือน: PDF ไม่ได้รับการโหลดอย่างเต็มที่สำหรับการพิมพ์
web_fonts_disabled=แบบอักษรเว็บถูกปิดใช้งาน: ไม่สามารถใช้แบบอักษร PDF ฝังตัว
# LOCALIZATION NOTE (unsupported_feature_signatures): Should contain the same
# exact string as in the `chrome.properties` file.
unsupported_feature_signatures=เอกสาร PDF นี้มีลายเซ็นดิจิทัล ไม่รองรับการตรวจสอบลายเซ็น

1205
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -2,25 +2,25 @@
"name": "pdf.js",
"version": "2.0.0",
"devDependencies": {
"@babel/core": "^7.14.0",
"@babel/plugin-proposal-logical-assignment-operators": "^7.13.8",
"@babel/core": "^7.14.2",
"@babel/plugin-proposal-logical-assignment-operators": "^7.14.2",
"@babel/plugin-transform-modules-commonjs": "^7.14.0",
"@babel/plugin-transform-runtime": "^7.13.15",
"@babel/preset-env": "^7.14.0",
"@babel/plugin-transform-runtime": "^7.14.2",
"@babel/preset-env": "^7.14.2",
"@babel/runtime": "^7.14.0",
"acorn": "^8.2.2",
"acorn": "^8.2.4",
"autoprefixer": "^10.2.5",
"babel-loader": "^8.2.2",
"canvas": "^2.7.0",
"core-js": "^3.11.1",
"core-js": "^3.12.1",
"cross-env": "^7.0.3",
"es-module-shims": "^0.10.4",
"es-module-shims": "^0.10.5",
"escodegen": "^2.0.0",
"eslint": "^7.25.0",
"eslint": "^7.26.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-fetch-options": "^0.0.5",
"eslint-plugin-html": "^6.1.2",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-import": "^2.23.2",
"eslint-plugin-mozilla": "^2.10.0",
"eslint-plugin-no-unsanitized": "^3.1.5",
"eslint-plugin-prettier": "^3.4.0",
@ -30,18 +30,18 @@
"gulp": "^4.0.2",
"gulp-postcss": "^9.0.0",
"gulp-rename": "^2.0.0",
"gulp-replace": "^1.1.2",
"gulp-replace": "^1.1.3",
"gulp-zip": "^5.1.0",
"jasmine": "^3.7.0",
"jsdoc": "^3.6.6",
"jsdoc": "^3.6.7",
"jstransformer-markdown-it": "^2.1.0",
"merge-stream": "^2.0.0",
"mkdirp": "^1.0.4",
"needle": "^2.6.0",
"postcss": "^8.2.13",
"postcss": "^8.2.15",
"postcss-calc": "^8.0.0",
"prettier": "^2.2.1",
"puppeteer": "^9.0.0",
"prettier": "^2.3.0",
"puppeteer": "^9.1.1",
"rimraf": "^3.0.2",
"streamqueue": "^1.1.2",
"stylelint": "^13.13.1",
@ -57,7 +57,7 @@
"vinyl": "^2.2.1",
"vinyl-fs": "^3.0.3",
"web-streams-polyfill": "^3.0.3",
"webpack": "^5.36.2",
"webpack": "^5.37.0",
"webpack-stream": "^6.1.2",
"wintersmith": "^2.5.0",
"yargs": "^16.2.0"

View File

@ -1589,11 +1589,8 @@ class WidgetAnnotation extends Annotation {
"Expected `_defaultAppearanceData` to have been set."
);
}
const {
localResources,
appearanceResources,
acroFormResources,
} = this._fieldResources;
const { localResources, appearanceResources, acroFormResources } =
this._fieldResources;
const fontName =
this.data.defaultAppearanceData &&

View File

@ -3205,9 +3205,8 @@ class PartialEvaluator {
// text-extraction. For simple fonts, containing encoding information,
// use a fallback ToUnicode map to improve this (fixes issue8229.pdf).
if (!properties.composite && properties.hasEncoding) {
properties.fallbackToUnicode = this._buildSimpleFontToUnicode(
properties
);
properties.fallbackToUnicode =
this._buildSimpleFontToUnicode(properties);
}
return Promise.resolve(properties.toUnicode);

View File

@ -999,12 +999,14 @@ class Font {
map[+charCode] = GlyphMapForStandardFonts[charCode];
}
if (/Arial-?Black/i.test(name)) {
const SupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack();
const SupplementalGlyphMapForArialBlack =
getSupplementalGlyphMapForArialBlack();
for (const charCode in SupplementalGlyphMapForArialBlack) {
map[+charCode] = SupplementalGlyphMapForArialBlack[charCode];
}
} else if (/Calibri/i.test(name)) {
const SupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri();
const SupplementalGlyphMapForCalibri =
getSupplementalGlyphMapForCalibri();
for (const charCode in SupplementalGlyphMapForCalibri) {
map[+charCode] = SupplementalGlyphMapForCalibri[charCode];
}
@ -1801,22 +1803,7 @@ class Font {
// glyf table cannot be empty -- redoing the glyf and loca tables
// to have single glyph with one point
const simpleGlyph = new Uint8Array([
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
49,
0,
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0,
]);
for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) {
itemEncode(locaData, j, simpleGlyph.length);
@ -2707,9 +2694,8 @@ class Font {
return charCode | 0;
}
}
newMapping.charCodeToGlyphId[
newMapping.nextAvailableFontCharCode
] = glyphId;
newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] =
glyphId;
return newMapping.nextAvailableFontCharCode++;
}

View File

@ -117,9 +117,8 @@ function mapStyle(styleStr) {
style.transform = newValue;
}
} else {
style[
key.replaceAll(/-([a-zA-Z])/g, (_, x) => x.toUpperCase())
] = newValue;
style[key.replaceAll(/-([a-zA-Z])/g, (_, x) => x.toUpperCase())] =
newValue;
}
}
return style;

View File

@ -3070,13 +3070,8 @@ const InternalRenderTask = (function InternalRenderTaskClosure() {
this.stepper.init(this.operatorList);
this.stepper.nextBreakPoint = this.stepper.getNextBreakPoint();
}
const {
canvasContext,
viewport,
transform,
imageLayer,
background,
} = this.params;
const { canvasContext, viewport, transform, imageLayer, background } =
this.params;
this.gfx = new CanvasGraphics(
canvasContext,

View File

@ -141,15 +141,13 @@ class PDFFetchStreamReader {
const getResponseHeader = name => {
return response.headers.get(name);
};
const {
allowRangeRequests,
suggestedLength,
} = validateRangeRequestCapabilities({
getResponseHeader,
isHttp: this._stream.isHttp,
rangeChunkSize: this._rangeChunkSize,
disableRange: this._disableRange,
});
const { allowRangeRequests, suggestedLength } =
validateRangeRequestCapabilities({
getResponseHeader,
isHttp: this._stream.isHttp,
rangeChunkSize: this._rangeChunkSize,
disableRange: this._disableRange,
});
this._isRangeSupported = allowRangeRequests;
// Setting right content length.

View File

@ -305,15 +305,13 @@ class PDFNetworkStreamFullRequestReader {
const getResponseHeader = name => {
return fullRequestXhr.getResponseHeader(name);
};
const {
allowRangeRequests,
suggestedLength,
} = validateRangeRequestCapabilities({
getResponseHeader,
isHttp: this._manager.isHttp,
rangeChunkSize: this._rangeChunkSize,
disableRange: this._disableRange,
});
const { allowRangeRequests, suggestedLength } =
validateRangeRequestCapabilities({
getResponseHeader,
isHttp: this._manager.isHttp,
rangeChunkSize: this._rangeChunkSize,
disableRange: this._disableRange,
});
if (allowRangeRequests) {
this._isRangeSupported = true;

View File

@ -330,15 +330,13 @@ class PDFNodeStreamFullReader extends BaseFullReader {
// here: https://nodejs.org/api/http.html#http_message_headers.
return this._readableStream.headers[name.toLowerCase()];
};
const {
allowRangeRequests,
suggestedLength,
} = validateRangeRequestCapabilities({
getResponseHeader,
isHttp: stream.isHttp,
rangeChunkSize: this._rangeChunkSize,
disableRange: this._disableRange,
});
const { allowRangeRequests, suggestedLength } =
validateRangeRequestCapabilities({
getResponseHeader,
isHttp: stream.isHttp,
rangeChunkSize: this._rangeChunkSize,
disableRange: this._disableRange,
});
this._isRangeSupported = allowRangeRequests;
// Setting right content length.

View File

@ -52,14 +52,7 @@ if (
const convertImgDataToPng = (function () {
const PNG_HEADER = new Uint8Array([
0x89,
0x50,
0x4e,
0x47,
0x0d,
0x0a,
0x1a,
0x0a,
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a,
]);
const CHUNK_WRAPPER_SIZE = 12;

View File

@ -75,8 +75,12 @@ function getAscent(fontFamily, ctx) {
ctx.strokeStyle = "red";
ctx.clearRect(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE);
ctx.strokeText("g", 0, 0);
let pixels = ctx.getImageData(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE)
.data;
let pixels = ctx.getImageData(
0,
0,
DEFAULT_FONT_SIZE,
DEFAULT_FONT_SIZE
).data;
descent = 0;
for (let i = pixels.length - 1 - 3; i >= 0; i -= 4) {
if (pixels[i] > 0) {

View File

@ -284,7 +284,8 @@ class Util extends PDFObject {
seconds: oDate.getSeconds(),
};
const patterns = /(mmmm|mmm|mm|m|dddd|ddd|dd|d|yyyy|yy|HH|H|hh|h|MM|M|ss|s|tt|t|\\.)/g;
const patterns =
/(mmmm|mmm|mm|m|dddd|ddd|dd|d|yyyy|yy|HH|H|hh|h|MM|M|ss|s|tt|t|\\.)/g;
return cFormat.replace(patterns, function (match, pattern) {
if (pattern in handlers) {
return handlers[pattern](data);
@ -517,7 +518,8 @@ class Util extends PDFObject {
// escape the string
const escapedFormat = cFormat.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&");
const patterns = /(mmmm|mmm|mm|m|dddd|ddd|dd|d|yyyy|yy|HH|H|hh|h|MM|M|ss|s|tt|t)/g;
const patterns =
/(mmmm|mmm|mm|m|dddd|ddd|dd|d|yyyy|yy|HH|H|hh|h|MM|M|ss|s|tt|t)/g;
const actions = [];
const re = escapedFormat.replace(

View File

@ -100,6 +100,7 @@ if (
if (isReadableStreamSupported) {
return;
}
globalThis.ReadableStream = require("web-streams-polyfill/dist/ponyfill.js").ReadableStream;
globalThis.ReadableStream =
require("web-streams-polyfill/dist/ponyfill.js").ReadableStream;
})();
}

View File

@ -26,7 +26,8 @@ function rewriteWebArchiveUrl(url) {
// Web Archive URLs need to be transformed to add `if_` after the ID.
// Without this, an HTML page containing an iframe with the PDF file
// will be served instead (issue 8920).
var webArchiveRegex = /(^https?:\/\/web\.archive\.org\/web\/)(\d+)(\/https?:\/\/.+)/g;
var webArchiveRegex =
/(^https?:\/\/web\.archive\.org\/web\/)(\d+)(\/https?:\/\/.+)/g;
var urlParts = webArchiveRegex.exec(url);
if (urlParts) {
return urlParts[1] + (urlParts[2] + "if_") + urlParts[3];

View File

@ -422,7 +422,8 @@ var Driver = (function DriverClosure() {
loadingTask.promise.then(
doc => {
task.pdfDoc = doc;
task.optionalContentConfigPromise = doc.getOptionalContentConfig();
task.optionalContentConfigPromise =
doc.getOptionalContentConfig();
this._nextPage(task, failure);
},
@ -600,9 +601,8 @@ var Driver = (function DriverClosure() {
}
annotationLayerCanvas.width = viewport.width;
annotationLayerCanvas.height = viewport.height;
var annotationLayerContext = annotationLayerCanvas.getContext(
"2d"
);
var annotationLayerContext =
annotationLayerCanvas.getContext("2d");
annotationLayerContext.clearRect(
0,
0,

View File

@ -843,8 +843,8 @@ function unitTestPostHandler(req, res) {
}
async function startBrowser(browserName, startUrl = "") {
const revisions = require("puppeteer/lib/cjs/puppeteer/revisions.js")
.PUPPETEER_REVISIONS;
const revisions =
require("puppeteer/lib/cjs/puppeteer/revisions.js").PUPPETEER_REVISIONS;
const wantedRevision =
browserName === "chrome" ? revisions.chromium : revisions.firefox;

View File

@ -230,24 +230,10 @@ describe("annotation", function () {
it("should process quadpoints in the standard order", function () {
rect = [10, 10, 20, 20];
dict.set("QuadPoints", [
10,
20,
20,
20,
10,
10,
20,
10,
11,
19,
19,
19,
11,
11,
19,
11,
]);
dict.set(
"QuadPoints",
[10, 20, 20, 20, 10, 10, 20, 10, 11, 19, 19, 19, 11, 11, 19, 11]
);
expect(getQuadPoints(dict, rect)).toEqual([
[
{ x: 10, y: 20 },

View File

@ -1066,12 +1066,8 @@ describe("api", function () {
});
it("gets metadata", async function () {
const {
info,
metadata,
contentDispositionFilename,
contentLength,
} = await pdfDocument.getMetadata();
const { info, metadata, contentDispositionFilename, contentLength } =
await pdfDocument.getMetadata();
expect(info.Title).toEqual("Basic API Test");
// Custom, non-standard, information dictionary entries.
@ -1096,12 +1092,8 @@ describe("api", function () {
buildGetDocumentParams("tracemonkey.pdf")
);
const pdfDoc = await loadingTask.promise;
const {
info,
metadata,
contentDispositionFilename,
contentLength,
} = await pdfDoc.getMetadata();
const { info, metadata, contentDispositionFilename, contentLength } =
await pdfDoc.getMetadata();
expect(info.Creator).toEqual("TeX");
expect(info.Producer).toEqual("pdfeTeX-1.21a");
@ -1132,12 +1124,8 @@ describe("api", function () {
it("gets metadata, with missing PDF header (bug 1606566)", async function () {
const loadingTask = getDocument(buildGetDocumentParams("bug1606566.pdf"));
const pdfDoc = await loadingTask.promise;
const {
info,
metadata,
contentDispositionFilename,
contentLength,
} = await pdfDoc.getMetadata();
const { info, metadata, contentDispositionFilename, contentLength } =
await pdfDoc.getMetadata();
// The following are PDF.js specific, non-standard, properties.
expect(info.PDFFormatVersion).toEqual(null);
@ -1445,13 +1433,12 @@ describe("api", function () {
docBaseUrl: "qwerty.pdf",
})
);
const invalidDocBaseUrlPromise = invalidDocBaseUrlLoadingTask.promise.then(
function (pdfDoc) {
const invalidDocBaseUrlPromise =
invalidDocBaseUrlLoadingTask.promise.then(function (pdfDoc) {
return pdfDoc.getPage(1).then(function (pdfPage) {
return pdfPage.getAnnotations();
});
}
);
});
const [
defaultAnnotations,
@ -1804,7 +1791,8 @@ describe("api", function () {
});
it("multiple render() on the same canvas", async function () {
const optionalContentConfigPromise = pdfDocument.getOptionalContentConfig();
const optionalContentConfigPromise =
pdfDocument.getOptionalContentConfig();
const viewport = page.getViewport({ scale: 1 });
const canvasAndCtx = CanvasFactory.create(

View File

@ -27,9 +27,8 @@ function getTopLeftPixel(canvasContext) {
}
describe("custom canvas rendering", function () {
const transparentGetDocumentParams = buildGetDocumentParams(
"transparent.pdf"
);
const transparentGetDocumentParams =
buildGetDocumentParams("transparent.pdf");
let CanvasFactory;
let loadingTask;

View File

@ -1,10 +0,0 @@
{
"extends": [
"../.eslintrc"
],
"rules": {
// Plugins
"import/no-unresolved": ["error", { "ignore": ["pdfjs-lib"]}],
},
}

View File

@ -1497,12 +1497,8 @@ const PDFViewerApplication = {
* @private
*/
async _initializeMetadata(pdfDocument) {
const {
info,
metadata,
contentDispositionFilename,
contentLength,
} = await pdfDocument.getMetadata();
const { info, metadata, contentDispositionFilename, contentLength } =
await pdfDocument.getMetadata();
if (pdfDocument !== this.pdfDocument) {
return; // The document was closed while the metadata resolved.
@ -1782,7 +1778,8 @@ const PDFViewerApplication = {
forceRendering() {
this.pdfRenderingQueue.printing = !!this.printService;
this.pdfRenderingQueue.isThumbnailViewEnabled = this.pdfSidebar.isThumbnailViewVisible;
this.pdfRenderingQueue.isThumbnailViewEnabled =
this.pdfSidebar.isThumbnailViewVisible;
this.pdfRenderingQueue.renderHighestPriority();
},
@ -1818,8 +1815,8 @@ const PDFViewerApplication = {
const pagesOverview = this.pdfViewer.getPagesOverview();
const printContainer = this.appConfig.printContainer;
const printResolution = AppOptions.get("printResolution");
const optionalContentConfigPromise = this.pdfViewer
.optionalContentConfigPromise;
const optionalContentConfigPromise =
this.pdfViewer.optionalContentConfigPromise;
const printService = PDFPrintServiceFactory.instance.createPrintService(
this.pdfDocument,
@ -2422,7 +2419,8 @@ function webViewerUpdateViewarea(evt) {
location.pdfOpenParams
);
PDFViewerApplication.appConfig.toolbar.viewBookmark.href = href;
PDFViewerApplication.appConfig.secondaryToolbar.viewBookmarkButton.href = href;
PDFViewerApplication.appConfig.secondaryToolbar.viewBookmarkButton.href =
href;
// Show/hide the loading indicator in the page number input element.
const currentPage = PDFViewerApplication.pdfViewer.getPageView(
@ -2684,10 +2682,8 @@ function setZoomDisabledTimeout() {
}
function webViewerWheel(evt) {
const {
pdfViewer,
supportedMouseWheelZoomModifierKeys,
} = PDFViewerApplication;
const { pdfViewer, supportedMouseWheelZoomModifierKeys } =
PDFViewerApplication;
if (pdfViewer.isInPresentationMode) {
return;

View File

@ -184,9 +184,8 @@ function requestAccessToLocalFile(fileUrl, overlayManager, callback) {
)[chrome.i18n.getUILanguage?.()];
if (i18nFileAccessLabel) {
document.getElementById(
"chrome-file-access-label"
).textContent = i18nFileAccessLabel;
document.getElementById("chrome-file-access-label").textContent =
i18nFileAccessLabel;
}
const link = document.getElementById("chrome-link-to-extensions-page");

View File

@ -18,14 +18,9 @@ import { getPdfFilenameFromUrl, loadScript } from "pdfjs-lib";
async function docPropertiesLookup(pdfDocument) {
const url = "",
baseUrl = url.split("#")[0];
/* eslint-disable prefer-const */
let {
info,
metadata,
contentDispositionFilename,
contentLength,
} = await pdfDocument.getMetadata();
/* eslint-enable prefer-const */
// eslint-disable-next-line prefer-const
let { info, metadata, contentDispositionFilename, contentLength } =
await pdfDocument.getMetadata();
if (!contentLength) {
const { length } = await pdfDocument.getDownloadInfo();

View File

@ -181,7 +181,8 @@ class PDFLayerViewer extends BaseTreeViewer {
return;
}
// Fetch the default optional content configuration...
const optionalContentConfig = await this._pdfDocument.getOptionalContentConfig();
const optionalContentConfig =
await this._pdfDocument.getOptionalContentConfig();
this.eventBus.dispatch("optionalcontentconfig", {
source: this,

View File

@ -365,10 +365,14 @@ class PDFPageView {
const width = this.viewport.width;
const height = this.viewport.height;
const div = this.div;
target.style.width = target.parentNode.style.width = div.style.width =
Math.floor(width) + "px";
target.style.height = target.parentNode.style.height = div.style.height =
Math.floor(height) + "px";
target.style.width =
target.parentNode.style.width =
div.style.width =
Math.floor(width) + "px";
target.style.height =
target.parentNode.style.height =
div.style.height =
Math.floor(height) + "px";
// The canvas may have been originally rotated; rotate relative to that.
const relativeRotation =
this.viewport.rotation - this.paintedViewportMap.get(target).rotation;
@ -579,17 +583,18 @@ class PDFPageView {
if (this.annotationLayerFactory) {
if (!this.annotationLayer) {
this.annotationLayer = this.annotationLayerFactory.createAnnotationLayerBuilder(
div,
pdfPage,
/* annotationStorage = */ null,
this.imageResourcesPath,
this.renderInteractiveForms,
this.l10n,
/* enableScripting */ null,
/* hasJSActionsPromise = */ null,
/* mouseState = */ null
);
this.annotationLayer =
this.annotationLayerFactory.createAnnotationLayerBuilder(
div,
pdfPage,
/* annotationStorage = */ null,
this.imageResourcesPath,
this.renderInteractiveForms,
this.l10n,
/* enableScripting */ null,
/* hasJSActionsPromise = */ null,
/* mouseState = */ null
);
}
this._renderAnnotationLayer();
}
@ -632,9 +637,8 @@ class PDFPageView {
});
};
this.eventBus._on("textlayerrendered", this._onTextLayerRendered);
this.structTreeLayer = this.structTreeLayerFactory.createStructTreeLayerBuilder(
pdfPage
);
this.structTreeLayer =
this.structTreeLayerFactory.createStructTreeLayerBuilder(pdfPage);
}
div.setAttribute("data-loaded", true);

View File

@ -313,9 +313,8 @@ class PDFThumbnailView {
// the `draw` and `setImage` methods (fixes issue 8233).
// NOTE: To primarily avoid increasing memory usage too much, but also to
// reduce downsizing overhead, we purposely limit the up-scaling factor.
const { ctx, canvas, transform } = this._getPageDrawContext(
DRAW_UPSCALE_FACTOR
);
const { ctx, canvas, transform } =
this._getPageDrawContext(DRAW_UPSCALE_FACTOR);
const drawViewport = this.viewport.clone({
scale: DRAW_UPSCALE_FACTOR * this.scale,
});

View File

@ -317,13 +317,8 @@ class TextLayerBuilder {
if (!this.renderingDone) {
return;
}
const {
findController,
matches,
pageIdx,
textContentItemsStr,
textDivs,
} = this;
const { findController, matches, pageIdx, textContentItemsStr, textDivs } =
this;
let clearedUntilDivIdx = -1;
// Clear all current matches.