pdf.js update

This commit is contained in:
j 2024-06-02 09:12:22 +01:00
parent 9e464a1d63
commit 8b60075f39
13 changed files with 611 additions and 652 deletions

View File

@ -448,8 +448,8 @@ See https://github.com/adobe-type-tools/cmap-resources
<button id="documentPropertiesClose" class="dialogButton"><span data-l10n-id="pdfjs-document-properties-close-button">Close</span></button>
</div>
</dialog>
<dialog id="altTextDialog" aria-labelledby="dialogLabel" aria-describedby="dialogDescription">
<div id="altTextContainer">
<dialog class="dialog altText" id="altTextDialog" aria-labelledby="dialogLabel" aria-describedby="dialogDescription">
<div id="altTextContainer" class="mainContainer">
<div id="overallDescription">
<span id="dialogLabel" data-l10n-id="pdfjs-editor-alt-text-dialog-label" class="title">Choose an option</span>
<span id="dialogDescription" data-l10n-id="pdfjs-editor-alt-text-dialog-description">
@ -486,8 +486,8 @@ See https://github.com/adobe-type-tools/cmap-resources
</div>
</div>
<div id="buttons">
<button id="altTextCancel" tabindex="0"><span data-l10n-id="pdfjs-editor-alt-text-cancel-button">Cancel</span></button>
<button id="altTextSave" tabindex="0"><span data-l10n-id="pdfjs-editor-alt-text-save-button">Save</span></button>
<button id="altTextCancel" class="secondaryButton" tabindex="0"><span data-l10n-id="pdfjs-editor-alt-text-cancel-button">Cancel</span></button>
<button id="altTextSave" class="primaryButton" tabindex="0"><span data-l10n-id="pdfjs-editor-alt-text-save-button">Save</span></button>
</div>
</div>
</dialog>

View File

@ -51,12 +51,6 @@ pdfjs-download-button-label = Discargar
pdfjs-bookmark-button =
.title = Pagina actual (vide le URL del pagina actual)
pdfjs-bookmark-button-label = Pagina actual
# Used in Firefox for Android.
pdfjs-open-in-app-button =
.title = Aperir in app
# Used in Firefox for Android.
# Length of the translation matters since we are in a mobile context, with limited screen estate.
pdfjs-open-in-app-button-label = Aperir in app
## Secondary toolbar and context menu
@ -67,8 +61,8 @@ pdfjs-first-page-button =
.title = Ir al prime pagina
pdfjs-first-page-button-label = Ir al prime pagina
pdfjs-last-page-button =
.title = Ir al prime pagina
pdfjs-last-page-button-label = Ir al prime pagina
.title = Ir al ultime pagina
pdfjs-last-page-button-label = Ir al ultime pagina
pdfjs-page-rotate-cw-button =
.title = Rotar in senso horari
pdfjs-page-rotate-cw-button-label = Rotar in senso horari
@ -304,8 +298,6 @@ pdfjs-editor-stamp-button-label = Adder o rediger imagines
pdfjs-editor-highlight-button =
.title = Evidentia
pdfjs-editor-highlight-button-label = Evidentia
pdfjs-highlight-floating-button =
.title = Evidentiar
pdfjs-highlight-floating-button1 =
.title = Evidentiar
.aria-label = Evidentiar

View File

@ -298,8 +298,6 @@ pdfjs-editor-stamp-button-label = 画像を追加または編集
pdfjs-editor-highlight-button =
.title = 強調します
pdfjs-editor-highlight-button-label = 強調
pdfjs-highlight-floating-button =
.title = 強調
pdfjs-highlight-floating-button1 =
.title = 強調
.aria-label = 強調します

View File

@ -51,12 +51,6 @@ pdfjs-download-button-label = Last ned
pdfjs-bookmark-button =
.title = Gjeldande side (sjå URL frå gjeldande side)
pdfjs-bookmark-button-label = Gjeldande side
# Used in Firefox for Android.
pdfjs-open-in-app-button =
.title = Opne i app
# Used in Firefox for Android.
# Length of the translation matters since we are in a mobile context, with limited screen estate.
pdfjs-open-in-app-button-label = Opne i app
## Secondary toolbar and context menu
@ -301,9 +295,24 @@ pdfjs-editor-ink-button-label = Teikne
pdfjs-editor-stamp-button =
.title = Legg til eller rediger bilde
pdfjs-editor-stamp-button-label = Legg til eller rediger bilde
pdfjs-editor-highlight-button =
.title = Markere
pdfjs-editor-highlight-button-label = Markere
pdfjs-highlight-floating-button1 =
.title = Markere
.aria-label = Markere
pdfjs-highlight-floating-button-label = Markere
## Remove button for the various kind of editor.
pdfjs-editor-remove-ink-button =
.title = Fjern teikninga
pdfjs-editor-remove-freetext-button =
.title = Fjern tekst
pdfjs-editor-remove-stamp-button =
.title = Fjern bildet
pdfjs-editor-remove-highlight-button =
.title = Fjern utheving
##
@ -316,6 +325,8 @@ pdfjs-editor-ink-opacity-input = Ugjennomskinleg
pdfjs-editor-stamp-add-image-button =
.title = Legg til bilde
pdfjs-editor-stamp-add-image-button-label = Legg til bilde
# This refers to the thickness of the line used for free highlighting (not bound to text)
pdfjs-editor-free-highlight-thickness-input = Tjukkleik
pdfjs-free-text =
.aria-label = Tekstredigering
pdfjs-free-text-default-content = Byrje å skrive…
@ -348,6 +359,10 @@ pdfjs-editor-alt-text-textarea =
## Color picker
pdfjs-editor-colorpicker-button =
.title = Endre farge
pdfjs-editor-colorpicker-dropdown =
.aria-label = Fargeval
pdfjs-editor-colorpicker-yellow =
.title = Gul
pdfjs-editor-colorpicker-green =
@ -358,3 +373,10 @@ pdfjs-editor-colorpicker-pink =
.title = Rosa
pdfjs-editor-colorpicker-red =
.title = Raud
## Show all highlights
## This is a toggle button to show/hide all the highlights.
pdfjs-editor-highlight-show-all-button-label = Vis alle
pdfjs-editor-highlight-show-all-button =
.title = Vis alle

View File

@ -302,6 +302,10 @@ pdfjs-editor-stamp-button-label = Dodajanje ali urejanje slik
pdfjs-editor-highlight-button =
.title = Označevalnik
pdfjs-editor-highlight-button-label = Označevalnik
pdfjs-highlight-floating-button1 =
.title = Označi
.aria-label = Označi
pdfjs-highlight-floating-button-label = Označi
## Remove button for the various kind of editor.

View File

@ -10217,7 +10217,7 @@ class TextLayer {
#textDivProperties = new WeakMap();
#transform = null;
static #ascentCache = new Map();
static #canvasCtx = null;
static #canvasContexts = new Map();
static #pendingTextLayers = new Set();
constructor({
textContentSource,
@ -10256,7 +10256,6 @@ class TextLayer {
this.#pageWidth = pageWidth;
this.#pageHeight = pageHeight;
setLayerDimensions(container, viewport);
TextLayer.#pendingTextLayers.add(this);
this.#capability.promise.catch(() => {}).then(() => {
TextLayer.#pendingTextLayers.delete(this);
this.#layoutTextParams = null;
@ -10280,6 +10279,7 @@ class TextLayer {
}, this.#capability.reject);
};
this.#reader = this.#textContentSource.getReader();
TextLayer.#pendingTextLayers.add(this);
pump();
return this.#capability.promise;
}
@ -10474,19 +10474,26 @@ class TextLayer {
return;
}
this.#ascentCache.clear();
this.#canvasCtx?.canvas.remove();
this.#canvasCtx = null;
for (const {
canvas
} of this.#canvasContexts.values()) {
canvas.remove();
}
this.#canvasContexts.clear();
}
static #getCtx(lang = null) {
if (!this.#canvasCtx) {
let canvasContext = this.#canvasContexts.get(lang ||= "");
if (!canvasContext) {
const canvas = document.createElement("canvas");
canvas.className = "hiddenCanvasElement";
canvas.lang = lang;
document.body.append(canvas);
this.#canvasCtx = canvas.getContext("2d", {
canvasContext = canvas.getContext("2d", {
alpha: false
});
this.#canvasContexts.set(lang, canvasContext);
}
return this.#canvasCtx;
return canvasContext;
}
static #getAscent(fontFamily, lang) {
const cachedAscent = this.#ascentCache.get(fontFamily);
@ -10717,7 +10724,7 @@ function getDocument(src) {
}
const docParams = {
docId,
apiVersion: "4.3.98",
apiVersion: "4.4.11",
data,
password,
disableAutoFetch,
@ -10741,11 +10748,13 @@ function getDocument(src) {
const transportParams = {
disableFontFace,
fontExtraProperties,
enableXfa,
ownerDocument,
disableAutoFetch,
pdfBug,
styleElement
styleElement,
loadingParams: {
disableAutoFetch,
enableXfa
}
};
worker.promise.then(function () {
if (task.destroyed) {
@ -11729,6 +11738,7 @@ class WorkerTransport {
ownerDocument: params.ownerDocument,
styleElement: params.styleElement
});
this.loadingParams = params.loadingParams;
this._params = params;
this.canvasFactory = factory.canvasFactory;
this.filterFactory = factory.filterFactory;
@ -12270,16 +12280,6 @@ class WorkerTransport {
const refStr = ref.gen === 0 ? `${ref.num}R` : `${ref.num}R${ref.gen}`;
return this.#pageRefCache.get(refStr) ?? null;
}
get loadingParams() {
const {
disableAutoFetch,
enableXfa
} = this._params;
return shadow(this, "loadingParams", {
disableAutoFetch,
enableXfa
});
}
}
const INITIAL_DATA = Symbol("INITIAL_DATA");
class PDFObjects {
@ -12491,8 +12491,8 @@ class InternalRenderTask {
}
}
}
const version = "4.3.98";
const build = "8dba041e6";
const version = "4.4.11";
const build = "d76501a0c";
;// CONCATENATED MODULE: ./src/shared/scripting_utils.js
function makeColorComp(n) {
@ -13175,15 +13175,9 @@ class AnnotationElement {
if (!quadPoints) {
return;
}
const [rectBlX, rectBlY, rectTrX, rectTrY] = this.data.rect;
if (quadPoints.length === 1) {
const [, {
x: trX,
y: trY
}, {
x: blX,
y: blY
}] = quadPoints[0];
const [rectBlX, rectBlY, rectTrX, rectTrY] = this.data.rect.map(x => Math.fround(x));
if (quadPoints.length === 8) {
const [trX, trY, blX, blY] = quadPoints.subarray(2, 6);
if (rectTrX === trX && rectTrY === trY && rectBlX === blX && rectBlY === blY) {
return;
}
@ -13217,13 +13211,11 @@ class AnnotationElement {
clipPath.setAttribute("id", id);
clipPath.setAttribute("clipPathUnits", "objectBoundingBox");
defs.append(clipPath);
for (const [, {
x: trX,
y: trY
}, {
x: blX,
y: blY
}] of quadPoints) {
for (let i = 2, ii = quadPoints.length; i < ii; i += 8) {
const trX = quadPoints[i];
const trY = quadPoints[i + 1];
const blX = quadPoints[i + 2];
const blY = quadPoints[i + 3];
const rect = svgFactory.createElement("rect");
const x = (blX - rectBlX) / width;
const y = (rectTrY - trY) / height;
@ -14936,27 +14928,37 @@ class PolylineAnnotationElement extends AnnotationElement {
}
render() {
this.container.classList.add(this.containerClassName);
const data = this.data;
const {
data: {
rect,
vertices,
borderStyle,
popupRef
}
} = this;
if (!vertices) {
return this.container;
}
const {
width,
height
} = getRectDims(data.rect);
} = getRectDims(rect);
const svg = this.svgFactory.create(width, height, true);
let points = [];
for (const coordinate of data.vertices) {
const x = coordinate.x - data.rect[0];
const y = data.rect[3] - coordinate.y;
points.push(x + "," + y);
for (let i = 0, ii = vertices.length; i < ii; i += 2) {
const x = vertices[i] - rect[0];
const y = rect[3] - vertices[i + 1];
points.push(`${x},${y}`);
}
points = points.join(" ");
const polyline = this.#polyline = this.svgFactory.createElement(this.svgElementName);
polyline.setAttribute("points", points);
polyline.setAttribute("stroke-width", data.borderStyle.width || 1);
polyline.setAttribute("stroke-width", borderStyle.width || 1);
polyline.setAttribute("stroke", "transparent");
polyline.setAttribute("fill", "transparent");
svg.append(polyline);
this.container.append(svg);
if (!data.popupRef && this.hasPopupData) {
if (!popupRef && this.hasPopupData) {
this._createPopup();
}
return this.container;
@ -15003,27 +15005,34 @@ class InkAnnotationElement extends AnnotationElement {
}
render() {
this.container.classList.add(this.containerClassName);
const data = this.data;
const {
data: {
rect,
inkLists,
borderStyle,
popupRef
}
} = this;
const {
width,
height
} = getRectDims(data.rect);
} = getRectDims(rect);
const svg = this.svgFactory.create(width, height, true);
for (const inkList of data.inkLists) {
for (const inkList of inkLists) {
let points = [];
for (const coordinate of inkList) {
const x = coordinate.x - data.rect[0];
const y = data.rect[3] - coordinate.y;
for (let i = 0, ii = inkList.length; i < ii; i += 2) {
const x = inkList[i] - rect[0];
const y = rect[3] - inkList[i + 1];
points.push(`${x},${y}`);
}
points = points.join(" ");
const polyline = this.svgFactory.createElement(this.svgElementName);
this.#polylines.push(polyline);
polyline.setAttribute("points", points);
polyline.setAttribute("stroke-width", data.borderStyle.width || 1);
polyline.setAttribute("stroke-width", borderStyle.width || 1);
polyline.setAttribute("stroke", "transparent");
polyline.setAttribute("fill", "transparent");
if (!data.popupRef && this.hasPopupData) {
if (!popupRef && this.hasPopupData) {
this._createPopup();
}
svg.append(polyline);
@ -17225,7 +17234,7 @@ class HighlightEditor extends AnnotationEditor {
}
const [pageWidth, pageHeight] = this.pageDimensions;
const boxes = this.#boxes;
const quadPoints = new Array(boxes.length * 8);
const quadPoints = new Float32Array(boxes.length * 8);
let i = 0;
for (const {
x,
@ -19367,8 +19376,8 @@ class DrawLayer {
const pdfjsVersion = "4.3.98";
const pdfjsBuild = "8dba041e6";
const pdfjsVersion = "4.4.11";
const pdfjsBuild = "d76501a0c";
var __webpack_exports__AbortException = __webpack_exports__.AbortException;
var __webpack_exports__AnnotationEditorLayer = __webpack_exports__.AnnotationEditorLayer;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -8930,11 +8930,10 @@ class Parser {
if (this.tryShift() && isCmd(this.buf2, "endstream")) {
this.shift();
} else {
const actualLength = this.#findStreamLength(startPos);
if (actualLength < 0) {
length = this.#findStreamLength(startPos);
if (length < 0) {
throw new FormatError("Missing endstream command.");
}
length = actualLength;
lexer.nextChar();
this.shift();
this.shift();
@ -29696,7 +29695,7 @@ class PartialEvaluator {
this.globalImageCache = globalImageCache;
this.systemFontCache = systemFontCache;
this.options = options || DefaultPartialEvaluatorOptions;
this.parsingType3Font = false;
this.type3FontRefs = null;
this._regionalImageCache = new RegionalImageCache();
this._fetchBuiltInCMapBound = this.fetchBuiltInCMap.bind(this);
ImageResizer.setMaxArea(this.options.canvasMaxAreaInBytes);
@ -29708,6 +29707,9 @@ class PartialEvaluator {
});
return shadow(this, "_pdfFunctionFactory", pdfFunctionFactory);
}
get parsingType3Font() {
return !!this.type3FontRefs;
}
clone(newOptions = null) {
const newEvaluator = Object.create(this);
newEvaluator.options = Object.assign(Object.create(null), this.options, newOptions);
@ -30396,13 +30398,17 @@ class PartialEvaluator {
}
}
if (fontRef) {
if (this.parsingType3Font && this.type3FontRefs.has(fontRef)) {
if (this.type3FontRefs?.has(fontRef)) {
return errorFont();
}
if (this.fontCache.has(fontRef)) {
return this.fontCache.get(fontRef);
}
font = this.xref.fetchIfRef(fontRef);
try {
font = this.xref.fetchIfRef(fontRef);
} catch (ex) {
warn(`loadFont - lookup failed: "${ex}".`);
}
}
if (!(font instanceof Dict)) {
if (!this.options.ignoreErrors && !this.parsingType3Font) {
@ -32827,7 +32833,6 @@ class TranslatedFont {
const type3Evaluator = evaluator.clone({
ignoreErrors: false
});
type3Evaluator.parsingType3Font = true;
const type3FontRefs = new RefSet(evaluator.type3FontRefs);
if (this.dict.objId && !type3FontRefs.has(this.dict.objId)) {
type3FontRefs.put(this.dict.objId);
@ -49607,38 +49612,19 @@ function getQuadPoints(dict, rect) {
if (!isNumberArray(quadPoints, null) || quadPoints.length === 0 || quadPoints.length % 8 > 0) {
return null;
}
const quadPointsLists = [];
for (let i = 0, ii = quadPoints.length / 8; i < ii; i++) {
let minX = Infinity,
maxX = -Infinity,
minY = Infinity,
maxY = -Infinity;
for (let j = i * 8, jj = i * 8 + 8; j < jj; j += 2) {
const x = quadPoints[j];
const y = quadPoints[j + 1];
minX = Math.min(x, minX);
maxX = Math.max(x, maxX);
minY = Math.min(y, minY);
maxY = Math.max(y, maxY);
}
const newQuadPoints = new Float32Array(quadPoints.length);
for (let i = 0, ii = quadPoints.length; i < ii; i += 8) {
const [x1, y1, x2, y2, x3, y3, x4, y4] = quadPoints.slice(i, i + 8);
const minX = Math.min(x1, x2, x3, x4);
const maxX = Math.max(x1, x2, x3, x4);
const minY = Math.min(y1, y2, y3, y4);
const maxY = Math.max(y1, y2, y3, y4);
if (rect !== null && (minX < rect[0] || maxX > rect[2] || minY < rect[1] || maxY > rect[3])) {
return null;
}
quadPointsLists.push([{
x: minX,
y: maxY
}, {
x: maxX,
y: maxY
}, {
x: minX,
y: minY
}, {
x: maxX,
y: minY
}]);
newQuadPoints.set([minX, maxY, maxX, maxY, minX, minY, maxX, minY], i);
}
return quadPointsLists;
return newQuadPoints;
}
function getTransformMatrix(rect, bbox, matrix) {
const [minX, minY, maxX, maxY] = Util.getAxialAlignedBoundingBox(bbox, matrix);
@ -50264,22 +50250,10 @@ class MarkupAnnotation extends Annotation {
}
let pointsArray = this.data.quadPoints;
if (!pointsArray) {
pointsArray = [[{
x: this.rectangle[0],
y: this.rectangle[3]
}, {
x: this.rectangle[2],
y: this.rectangle[3]
}, {
x: this.rectangle[0],
y: this.rectangle[1]
}, {
x: this.rectangle[2],
y: this.rectangle[1]
}]];
pointsArray = Float32Array.from([this.rectangle[0], this.rectangle[3], this.rectangle[2], this.rectangle[3], this.rectangle[0], this.rectangle[1], this.rectangle[2], this.rectangle[1]]);
}
for (const points of pointsArray) {
const [mX, MX, mY, MY] = pointsCallback(buffer, points);
for (let i = 0, ii = pointsArray.length; i < ii; i += 8) {
const [mX, MX, mY, MY] = pointsCallback(buffer, pointsArray.subarray(i, i + 8));
minX = Math.min(minX, mX);
maxX = Math.max(maxX, MX);
minY = Math.min(minY, mY);
@ -51930,7 +51904,7 @@ class LineAnnotation extends MarkupAnnotation {
fillAlpha,
pointsCallback: (buffer, points) => {
buffer.push(`${lineCoordinates[0]} ${lineCoordinates[1]} m`, `${lineCoordinates[2]} ${lineCoordinates[3]} l`, "S");
return [points[0].x - borderWidth, points[1].x + borderWidth, points[3].y - borderWidth, points[1].y + borderWidth];
return [points[0] - borderWidth, points[2] + borderWidth, points[7] - borderWidth, points[3] + borderWidth];
}
});
}
@ -51963,17 +51937,17 @@ class SquareAnnotation extends MarkupAnnotation {
strokeAlpha,
fillAlpha,
pointsCallback: (buffer, points) => {
const x = points[2].x + this.borderStyle.width / 2;
const y = points[2].y + this.borderStyle.width / 2;
const width = points[3].x - points[2].x - this.borderStyle.width;
const height = points[1].y - points[3].y - this.borderStyle.width;
const x = points[4] + this.borderStyle.width / 2;
const y = points[5] + this.borderStyle.width / 2;
const width = points[6] - points[4] - this.borderStyle.width;
const height = points[3] - points[7] - this.borderStyle.width;
buffer.push(`${x} ${y} ${width} ${height} re`);
if (fillColor) {
buffer.push("B");
} else {
buffer.push("S");
}
return [points[0].x, points[1].x, points[3].y, points[1].y];
return [points[0], points[2], points[7], points[3]];
}
});
}
@ -52005,10 +51979,10 @@ class CircleAnnotation extends MarkupAnnotation {
strokeAlpha,
fillAlpha,
pointsCallback: (buffer, points) => {
const x0 = points[0].x + this.borderStyle.width / 2;
const y0 = points[0].y - this.borderStyle.width / 2;
const x1 = points[3].x - this.borderStyle.width / 2;
const y1 = points[3].y + this.borderStyle.width / 2;
const x0 = points[0] + this.borderStyle.width / 2;
const y0 = points[1] - this.borderStyle.width / 2;
const x1 = points[6] - this.borderStyle.width / 2;
const y1 = points[7] + this.borderStyle.width / 2;
const xMid = x0 + (x1 - x0) / 2;
const yMid = y0 + (y1 - y0) / 2;
const xOffset = (x1 - x0) / 2 * controlPointsDistance;
@ -52019,7 +51993,7 @@ class CircleAnnotation extends MarkupAnnotation {
} else {
buffer.push("S");
}
return [points[0].x, points[1].x, points[3].y, points[1].y];
return [points[0], points[2], points[7], points[3]];
}
});
}
@ -52035,7 +52009,7 @@ class PolylineAnnotation extends MarkupAnnotation {
this.data.annotationType = AnnotationType.POLYLINE;
this.data.hasOwnCanvas = this.data.noRotate;
this.data.noHTML = false;
this.data.vertices = [];
this.data.vertices = null;
if (!(this instanceof PolygonAnnotation)) {
this.setLineEndings(dict.getArray("LE"));
this.data.lineEndings = this.lineEndings;
@ -52044,23 +52018,18 @@ class PolylineAnnotation extends MarkupAnnotation {
if (!isNumberArray(rawVertices, null)) {
return;
}
for (let i = 0, ii = rawVertices.length; i < ii; i += 2) {
this.data.vertices.push({
x: rawVertices[i],
y: rawVertices[i + 1]
});
}
const vertices = this.data.vertices = Float32Array.from(rawVertices);
if (!this.appearance) {
const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
const strokeAlpha = dict.get("CA");
const borderWidth = this.borderStyle.width || 1,
borderAdjust = 2 * borderWidth;
const bbox = [Infinity, Infinity, -Infinity, -Infinity];
for (const vertex of this.data.vertices) {
bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
for (let i = 0, ii = vertices.length; i < ii; i += 2) {
bbox[0] = Math.min(bbox[0], vertices[i] - borderAdjust);
bbox[1] = Math.min(bbox[1], vertices[i + 1] - borderAdjust);
bbox[2] = Math.max(bbox[2], vertices[i] + borderAdjust);
bbox[3] = Math.max(bbox[3], vertices[i + 1] + borderAdjust);
}
if (!Util.intersect(this.rectangle, bbox)) {
this.rectangle = bbox;
@ -52071,12 +52040,11 @@ class PolylineAnnotation extends MarkupAnnotation {
strokeColor,
strokeAlpha,
pointsCallback: (buffer, points) => {
const vertices = this.data.vertices;
for (let i = 0, ii = vertices.length; i < ii; i++) {
buffer.push(`${vertices[i].x} ${vertices[i].y} ${i === 0 ? "m" : "l"}`);
for (let i = 0, ii = vertices.length; i < ii; i += 2) {
buffer.push(`${vertices[i]} ${vertices[i + 1]} ${i === 0 ? "m" : "l"}`);
}
buffer.push("S");
return [points[0].x, points[1].x, points[3].y, points[1].y];
return [points[0], points[2], points[7], points[3]];
}
});
}
@ -52110,18 +52078,17 @@ class InkAnnotation extends MarkupAnnotation {
return;
}
for (let i = 0, ii = rawInkLists.length; i < ii; ++i) {
this.data.inkLists.push([]);
if (!Array.isArray(rawInkLists[i])) {
continue;
}
const inkList = new Float32Array(rawInkLists[i].length);
this.data.inkLists.push(inkList);
for (let j = 0, jj = rawInkLists[i].length; j < jj; j += 2) {
const x = xref.fetchIfRef(rawInkLists[i][j]),
y = xref.fetchIfRef(rawInkLists[i][j + 1]);
if (typeof x === "number" && typeof y === "number") {
this.data.inkLists[i].push({
x,
y
});
inkList[j] = x;
inkList[j + 1] = y;
}
}
}
@ -52131,12 +52098,12 @@ class InkAnnotation extends MarkupAnnotation {
const borderWidth = this.borderStyle.width || 1,
borderAdjust = 2 * borderWidth;
const bbox = [Infinity, Infinity, -Infinity, -Infinity];
for (const inkLists of this.data.inkLists) {
for (const vertex of inkLists) {
bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
for (const inkList of this.data.inkLists) {
for (let i = 0, ii = inkList.length; i < ii; i += 2) {
bbox[0] = Math.min(bbox[0], inkList[i] - borderAdjust);
bbox[1] = Math.min(bbox[1], inkList[i + 1] - borderAdjust);
bbox[2] = Math.max(bbox[2], inkList[i] + borderAdjust);
bbox[3] = Math.max(bbox[3], inkList[i + 1] + borderAdjust);
}
}
if (!Util.intersect(this.rectangle, bbox)) {
@ -52149,12 +52116,12 @@ class InkAnnotation extends MarkupAnnotation {
strokeAlpha,
pointsCallback: (buffer, points) => {
for (const inkList of this.data.inkLists) {
for (let i = 0, ii = inkList.length; i < ii; i++) {
buffer.push(`${inkList[i].x} ${inkList[i].y} ${i === 0 ? "m" : "l"}`);
for (let i = 0, ii = inkList.length; i < ii; i += 2) {
buffer.push(`${inkList[i]} ${inkList[i + 1]} ${i === 0 ? "m" : "l"}`);
}
buffer.push("S");
}
return [points[0].x, points[1].x, points[3].y, points[1].y];
return [points[0], points[2], points[7], points[3]];
}
});
}
@ -52316,8 +52283,8 @@ class HighlightAnnotation extends MarkupAnnotation {
blendMode: "Multiply",
fillAlpha,
pointsCallback: (buffer, points) => {
buffer.push(`${points[0].x} ${points[0].y} m`, `${points[1].x} ${points[1].y} l`, `${points[3].x} ${points[3].y} l`, `${points[2].x} ${points[2].y} l`, "f");
return [points[0].x, points[1].x, points[3].y, points[1].y];
buffer.push(`${points[0]} ${points[1]} m`, `${points[2]} ${points[3]} l`, `${points[6]} ${points[7]} l`, `${points[4]} ${points[5]} l`, "f");
return [points[0], points[2], points[7], points[3]];
}
});
}
@ -52419,8 +52386,8 @@ class UnderlineAnnotation extends MarkupAnnotation {
strokeColor,
strokeAlpha,
pointsCallback: (buffer, points) => {
buffer.push(`${points[2].x} ${points[2].y + 1.3} m`, `${points[3].x} ${points[3].y + 1.3} l`, "S");
return [points[0].x, points[1].x, points[3].y, points[1].y];
buffer.push(`${points[4]} ${points[5] + 1.3} m`, `${points[6]} ${points[7] + 1.3} l`, "S");
return [points[0], points[2], points[7], points[3]];
}
});
}
@ -52448,11 +52415,11 @@ class SquigglyAnnotation extends MarkupAnnotation {
strokeColor,
strokeAlpha,
pointsCallback: (buffer, points) => {
const dy = (points[0].y - points[2].y) / 6;
const dy = (points[1] - points[5]) / 6;
let shift = dy;
let x = points[2].x;
const y = points[2].y;
const xEnd = points[3].x;
let x = points[4];
const y = points[5];
const xEnd = points[6];
buffer.push(`${x} ${y + shift} m`);
do {
x += 2;
@ -52460,7 +52427,7 @@ class SquigglyAnnotation extends MarkupAnnotation {
buffer.push(`${x} ${y + shift} l`);
} while (x < xEnd);
buffer.push("S");
return [points[2].x, xEnd, y - 2 * dy, y + 2 * dy];
return [points[4], xEnd, y - 2 * dy, y + 2 * dy];
}
});
}
@ -52488,8 +52455,8 @@ class StrikeOutAnnotation extends MarkupAnnotation {
strokeColor,
strokeAlpha,
pointsCallback: (buffer, points) => {
buffer.push(`${(points[0].x + points[2].x) / 2} ` + `${(points[0].y + points[2].y) / 2} m`, `${(points[1].x + points[3].x) / 2} ` + `${(points[1].y + points[3].y) / 2} l`, "S");
return [points[0].x, points[1].x, points[3].y, points[1].y];
buffer.push(`${(points[0] + points[4]) / 2} ` + `${(points[1] + points[5]) / 2} m`, `${(points[2] + points[6]) / 2} ` + `${(points[3] + points[7]) / 2} l`, "S");
return [points[0], points[2], points[7], points[3]];
}
});
}
@ -53718,52 +53685,49 @@ class Page {
systemFontCache: this.systemFontCache,
options: this.evaluatorOptions
});
const newAnnotationsByPage = !this.xfaFactory ? getNewAnnotationsMap(annotationStorage) : null;
let deletedAnnotations = null;
const newAnnotsByPage = !this.xfaFactory ? getNewAnnotationsMap(annotationStorage) : null;
const newAnnots = newAnnotsByPage?.get(this.pageIndex);
let newAnnotationsPromise = Promise.resolve(null);
if (newAnnotationsByPage) {
const newAnnotations = newAnnotationsByPage.get(this.pageIndex);
if (newAnnotations) {
const annotationGlobalsPromise = this.pdfManager.ensureDoc("annotationGlobals");
let imagePromises;
const missingBitmaps = new Set();
for (const {
bitmapId,
bitmap
} of newAnnotations) {
if (bitmapId && !bitmap && !missingBitmaps.has(bitmapId)) {
missingBitmaps.add(bitmapId);
}
let deletedAnnotations = null;
if (newAnnots) {
const annotationGlobalsPromise = this.pdfManager.ensureDoc("annotationGlobals");
let imagePromises;
const missingBitmaps = new Set();
for (const {
bitmapId,
bitmap
} of newAnnots) {
if (bitmapId && !bitmap && !missingBitmaps.has(bitmapId)) {
missingBitmaps.add(bitmapId);
}
const {
isOffscreenCanvasSupported
} = this.evaluatorOptions;
if (missingBitmaps.size > 0) {
const annotationWithBitmaps = newAnnotations.slice();
for (const [key, annotation] of annotationStorage) {
if (!key.startsWith(AnnotationEditorPrefix)) {
continue;
}
if (annotation.bitmap && missingBitmaps.has(annotation.bitmapId)) {
annotationWithBitmaps.push(annotation);
}
}
imagePromises = AnnotationFactory.generateImages(annotationWithBitmaps, this.xref, isOffscreenCanvasSupported);
} else {
imagePromises = AnnotationFactory.generateImages(newAnnotations, this.xref, isOffscreenCanvasSupported);
}
deletedAnnotations = new RefSet();
this.#replaceIdByRef(newAnnotations, deletedAnnotations, null);
newAnnotationsPromise = annotationGlobalsPromise.then(annotationGlobals => {
if (!annotationGlobals) {
return null;
}
return AnnotationFactory.printNewAnnotations(annotationGlobals, partialEvaluator, task, newAnnotations, imagePromises);
});
}
const {
isOffscreenCanvasSupported
} = this.evaluatorOptions;
if (missingBitmaps.size > 0) {
const annotationWithBitmaps = newAnnots.slice();
for (const [key, annotation] of annotationStorage) {
if (!key.startsWith(AnnotationEditorPrefix)) {
continue;
}
if (annotation.bitmap && missingBitmaps.has(annotation.bitmapId)) {
annotationWithBitmaps.push(annotation);
}
}
imagePromises = AnnotationFactory.generateImages(annotationWithBitmaps, this.xref, isOffscreenCanvasSupported);
} else {
imagePromises = AnnotationFactory.generateImages(newAnnots, this.xref, isOffscreenCanvasSupported);
}
deletedAnnotations = new RefSet();
this.#replaceIdByRef(newAnnots, deletedAnnotations, null);
newAnnotationsPromise = annotationGlobalsPromise.then(annotationGlobals => {
if (!annotationGlobals) {
return null;
}
return AnnotationFactory.printNewAnnotations(annotationGlobals, partialEvaluator, task, newAnnots, imagePromises);
});
}
const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
const pageListPromise = dataPromises.then(([contentStream]) => {
const pageListPromise = Promise.all([contentStreamPromise, resourcesPromise]).then(([contentStream]) => {
const opList = new OperatorList(intent, sink);
handler.send("StartRenderPage", {
transparency: partialEvaluator.hasBlendModes(this.resources, this.nonBlendModesSet),
@ -54550,7 +54514,7 @@ class PDFDocument {
if (type instanceof Ref) {
type = await xref.fetchAsync(type);
}
if (isName(type, "Page") || !obj.has("Type") && !obj.has("Kids")) {
if (isName(type, "Page") || !obj.has("Type") && !obj.has("Kids") && obj.has("Contents")) {
if (!catalog.pageKidsCountCache.has(ref)) {
catalog.pageKidsCountCache.put(ref, 1);
}
@ -55528,7 +55492,7 @@ class WorkerMessageHandler {
docId,
apiVersion
} = docParams;
const workerVersion = "4.3.98";
const workerVersion = "4.4.11";
if (apiVersion !== workerVersion) {
throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
}
@ -56098,8 +56062,8 @@ if (typeof window === "undefined" && !isNodeJS && typeof self !== "undefined" &&
;// CONCATENATED MODULE: ./src/pdf.worker.js
const pdfjsVersion = "4.3.98";
const pdfjsBuild = "8dba041e6";
const pdfjsVersion = "4.4.11";
const pdfjsBuild = "d76501a0c";
var __webpack_exports__WorkerMessageHandler = __webpack_exports__.WorkerMessageHandler;
export { __webpack_exports__WorkerMessageHandler as WorkerMessageHandler };

File diff suppressed because one or more lines are too long

View File

@ -13,6 +13,242 @@
* limitations under the License.
*/
.dialog{
--dialog-bg-color:white;
--dialog-border-color:white;
--dialog-shadow:0 2px 14px 0 rgb(58 57 68 / 0.2);
--text-primary-color:#15141a;
--text-secondary-color:#5b5b66;
--hover-filter:brightness(0.9);
--focus-ring-color:#0060df;
--focus-ring-outline:2px solid var(--focus-ring-color);
--textarea-border-color:#8f8f9d;
--textarea-bg-color:white;
--textarea-fg-color:var(--text-secondary-color);
--radio-bg-color:#f0f0f4;
--radio-checked-bg-color:#fbfbfe;
--radio-border-color:#8f8f9d;
--radio-checked-border-color:#0060df;
--button-secondary-bg-color:#f0f0f4;
--button-secondary-fg-color:var(--text-primary-color);
--button-secondary-border-color:var(--button-secondary-bg-color);
--button-secondary-hover-bg-color:var(--button-secondary-bg-color);
--button-secondary-hover-fg-color:var(--button-secondary-fg-color);
--button-secondary-hover-border-color:var(--button-secondary-hover-bg-color);
--button-primary-bg-color:#0060df;
--button-primary-fg-color:#fbfbfe;
--button-primary-hover-bg-color:var(--button-primary-bg-color);
--button-primary-hover-fg-color:var(--button-primary-fg-color);
--button-primary-hover-border-color:var(--button-primary-hover-bg-color);
font:message-box;
font-size:13px;
font-weight:400;
line-height:150%;
border-radius:4px;
padding:12px 16px;
border:1px solid var(--dialog-border-color);
background:var(--dialog-bg-color);
color:var(--text-primary-color);
box-shadow:var(--dialog-shadow);
}
@media (prefers-color-scheme: dark){
:where(html:not(.is-light)) .dialog{
--dialog-bg-color:#1c1b22;
--dialog-border-color:#1c1b22;
--dialog-shadow:0 2px 14px 0 #15141a;
--text-primary-color:#fbfbfe;
--text-secondary-color:#cfcfd8;
--focus-ring-color:#0df;
--hover-filter:brightness(1.4);
--textarea-bg-color:#42414d;
--radio-bg-color:#2b2a33;
--radio-checked-bg-color:#15141a;
--radio-checked-border-color:#0df;
--button-secondary-bg-color:#2b2a33;
--button-primary-bg-color:#0df;
--button-primary-fg-color:#15141a;
}
}
:where(html.is-dark) .dialog{
--dialog-bg-color:#1c1b22;
--dialog-border-color:#1c1b22;
--dialog-shadow:0 2px 14px 0 #15141a;
--text-primary-color:#fbfbfe;
--text-secondary-color:#cfcfd8;
--focus-ring-color:#0df;
--hover-filter:brightness(1.4);
--textarea-bg-color:#42414d;
--radio-bg-color:#2b2a33;
--radio-checked-bg-color:#15141a;
--radio-checked-border-color:#0df;
--button-secondary-bg-color:#2b2a33;
--button-primary-bg-color:#0df;
--button-primary-fg-color:#15141a;
}
@media screen and (forced-colors: active){
.dialog{
--dialog-bg-color:Canvas;
--dialog-border-color:CanvasText;
--dialog-shadow:none;
--text-primary-color:CanvasText;
--text-secondary-color:CanvasText;
--hover-filter:none;
--focus-ring-color:ButtonBorder;
--textarea-border-color:ButtonBorder;
--textarea-bg-color:Field;
--textarea-fg-color:ButtonText;
--radio-bg-color:ButtonFace;
--radio-checked-bg-color:ButtonFace;
--radio-border-color:ButtonText;
--radio-checked-border-color:ButtonText;
--button-secondary-bg-color:ButtonFace;
--button-secondary-fg-color:ButtonText;
--button-secondary-border-color:ButtonText;
--button-secondary-hover-bg-color:AccentColor;
--button-secondary-hover-fg-color:AccentColorText;
--button-primary-bg-color:ButtonText;
--button-primary-fg-color:ButtonFace;
--button-primary-hover-bg-color:AccentColor;
--button-primary-hover-fg-color:AccentColorText;
}
}
.dialog .mainContainer *:focus-visible{
outline:var(--focus-ring-outline);
outline-offset:2px;
}
.dialog .mainContainer .radio{
display:flex;
flex-direction:column;
align-items:flex-start;
gap:4px;
}
.dialog .mainContainer .radio > .radioButton{
display:flex;
gap:8px;
align-self:stretch;
align-items:center;
}
.dialog .mainContainer .radio > .radioButton input{
-webkit-appearance:none;
-moz-appearance:none;
appearance:none;
box-sizing:border-box;
width:16px;
height:16px;
border-radius:50%;
background-color:var(--radio-bg-color);
border:1px solid var(--radio-border-color);
}
.dialog .mainContainer .radio > .radioButton input:hover{
filter:var(--hover-filter);
}
.dialog .mainContainer .radio > .radioButton input:checked{
background-color:var(--radio-checked-bg-color);
border:4px solid var(--radio-checked-border-color);
}
.dialog .mainContainer .radio > .radioLabel{
display:flex;
padding-inline-start:24px;
align-items:flex-start;
gap:10px;
align-self:stretch;
}
.dialog .mainContainer .radio > .radioLabel > span{
flex:1 0 0;
font-size:11px;
color:var(--text-secondary-color);
}
.dialog .mainContainer button{
border-radius:4px;
border:1px solid;
font:menu;
font-weight:600;
padding:4px 16px;
width:auto;
height:32px;
}
.dialog .mainContainer button:hover{
cursor:pointer;
filter:var(--hover-filter);
}
.dialog .mainContainer button.secondaryButton{
color:var(--button-secondary-fg-color);
background-color:var(--button-secondary-bg-color);
border-color:var(--button-secondary-border-color);
}
.dialog .mainContainer button.secondaryButton:hover{
color:var(--button-secondary-hover-fg-color);
background-color:var(--button-secondary-hover-bg-color);
border-color:var(--button-secondary-hover-border-color);
}
.dialog .mainContainer button.primaryButton{
color:var(--button-primary-hover-fg-color);
background-color:var(--button-primary-hover-bg-color);
border-color:var(--button-primary-hover-border-color);
opacity:1;
}
.dialog .mainContainer button.primaryButton:hover{
color:var(--button-primary-hover-fg-color);
background-color:var(--button-primary-hover-bg-color);
border-color:var(--button-primary-hover-border-color);
}
.dialog .mainContainer textarea{
font:inherit;
padding:8px;
resize:none;
margin:0;
box-sizing:border-box;
border-radius:4px;
border:1px solid var(--textarea-border-color);
background:var(--textarea-bg-color);
color:var(--textarea-fg-color);
}
.dialog .mainContainer textarea:focus{
outline-offset:0;
border-color:transparent;
}
.dialog .mainContainer textarea:disabled{
pointer-events:none;
opacity:0.4;
}
.textLayer{
position:absolute;
text-align:initial;
@ -1946,136 +2182,16 @@
inset-block-start:0;
}
#altTextDialog{
--dialog-bg-color:white;
--dialog-border-color:white;
--dialog-shadow:0 2px 14px 0 rgb(58 57 68 / 0.2);
--text-primary-color:#15141a;
--text-secondary-color:#5b5b66;
--hover-filter:brightness(0.9);
--focus-ring-color:#0060df;
--focus-ring-outline:2px solid var(--focus-ring-color);
--textarea-border-color:#8f8f9d;
--textarea-bg-color:white;
--textarea-fg-color:var(--text-secondary-color);
--radio-bg-color:#f0f0f4;
--radio-checked-bg-color:#fbfbfe;
--radio-border-color:#8f8f9d;
--radio-checked-border-color:#0060df;
--button-cancel-bg-color:#f0f0f4;
--button-cancel-fg-color:var(--text-primary-color);
--button-cancel-border-color:var(--button-cancel-bg-color);
--button-cancel-hover-bg-color:var(--button-cancel-bg-color);
--button-cancel-hover-fg-color:var(--button-cancel-fg-color);
--button-cancel-hover-border-color:var(--button-cancel-hover-bg-color);
--button-save-bg-color:#0060df;
--button-save-fg-color:#fbfbfe;
--button-save-hover-bg-color:var(--button-save-bg-color);
--button-save-hover-fg-color:var(--button-save-fg-color);
--button-save-hover-border-color:var(--button-save-hover-bg-color);
font:message-box;
font-size:13px;
font-weight:400;
line-height:150%;
border-radius:4px;
padding:12px 16px;
border:1px solid var(--dialog-border-color);
background:var(--dialog-bg-color);
color:var(--text-primary-color);
box-shadow:var(--dialog-shadow);
}
@media (prefers-color-scheme: dark){
:where(html:not(.is-light)) #altTextDialog{
--dialog-bg-color:#1c1b22;
--dialog-border-color:#1c1b22;
--dialog-shadow:0 2px 14px 0 #15141a;
--text-primary-color:#fbfbfe;
--text-secondary-color:#cfcfd8;
--focus-ring-color:#0df;
--hover-filter:brightness(1.4);
--textarea-bg-color:#42414d;
--radio-bg-color:#2b2a33;
--radio-checked-bg-color:#15141a;
--radio-checked-border-color:#0df;
--button-cancel-bg-color:#2b2a33;
--button-save-bg-color:#0df;
--button-save-fg-color:#15141a;
}
}
:where(html.is-dark) #altTextDialog{
--dialog-bg-color:#1c1b22;
--dialog-border-color:#1c1b22;
--dialog-shadow:0 2px 14px 0 #15141a;
--text-primary-color:#fbfbfe;
--text-secondary-color:#cfcfd8;
--focus-ring-color:#0df;
--hover-filter:brightness(1.4);
--textarea-bg-color:#42414d;
--radio-bg-color:#2b2a33;
--radio-checked-bg-color:#15141a;
--radio-checked-border-color:#0df;
--button-cancel-bg-color:#2b2a33;
--button-save-bg-color:#0df;
--button-save-fg-color:#15141a;
}
@media screen and (forced-colors: active){
#altTextDialog{
--dialog-bg-color:Canvas;
--dialog-border-color:CanvasText;
--dialog-shadow:none;
--text-primary-color:CanvasText;
--text-secondary-color:CanvasText;
--hover-filter:none;
--focus-ring-color:ButtonBorder;