|
26 | 26 |
|
27 | 27 | import { jsPDF, GState, ShadingPattern, TilingPattern } from './jspdf.mjs'; |
28 | 28 |
|
29 | | -/****************************************************************************** |
30 | | -Copyright (c) Microsoft Corporation. |
31 | | -
|
32 | | -Permission to use, copy, modify, and/or distribute this software for any |
33 | | -purpose with or without fee is hereby granted. |
34 | | -
|
35 | | -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH |
36 | | -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY |
37 | | -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, |
38 | | -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM |
39 | | -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR |
40 | | -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
41 | | -PERFORMANCE OF THIS SOFTWARE. |
42 | | -***************************************************************************** */ |
43 | | -/* global Reflect, Promise */ |
44 | | - |
45 | | -var extendStatics = function(d, b) { |
46 | | - extendStatics = Object.setPrototypeOf || |
47 | | - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || |
48 | | - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; |
49 | | - return extendStatics(d, b); |
50 | | -}; |
51 | | - |
52 | | -function __extends(d, b) { |
53 | | - if (typeof b !== "function" && b !== null) |
54 | | - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); |
55 | | - extendStatics(d, b); |
56 | | - function __() { this.constructor = d; } |
57 | | - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); |
58 | | -} |
59 | | - |
60 | | -var __assign = function() { |
61 | | - __assign = Object.assign || function __assign(t) { |
62 | | - for (var s, i = 1, n = arguments.length; i < n; i++) { |
63 | | - s = arguments[i]; |
64 | | - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; |
65 | | - } |
66 | | - return t; |
67 | | - }; |
68 | | - return __assign.apply(this, arguments); |
69 | | -}; |
70 | | - |
71 | | -function __awaiter(thisArg, _arguments, P, generator) { |
72 | | - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } |
73 | | - return new (P || (P = Promise))(function (resolve, reject) { |
74 | | - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } |
75 | | - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } |
76 | | - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } |
77 | | - step((generator = generator.apply(thisArg, _arguments || [])).next()); |
78 | | - }); |
79 | | -} |
80 | | - |
81 | | -function __generator(thisArg, body) { |
82 | | - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; |
83 | | - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; |
84 | | - function verb(n) { return function (v) { return step([n, v]); }; } |
85 | | - function step(op) { |
86 | | - if (f) throw new TypeError("Generator is already executing."); |
87 | | - while (_) try { |
88 | | - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; |
89 | | - if (y = 0, t) op = [op[0] & 2, t.value]; |
90 | | - switch (op[0]) { |
91 | | - case 0: case 1: t = op; break; |
92 | | - case 4: _.label++; return { value: op[1], done: false }; |
93 | | - case 5: _.label++; y = op[1]; op = [0]; continue; |
94 | | - case 7: op = _.ops.pop(); _.trys.pop(); continue; |
95 | | - default: |
96 | | - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } |
97 | | - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } |
98 | | - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } |
99 | | - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } |
100 | | - if (t[2]) _.ops.pop(); |
101 | | - _.trys.pop(); continue; |
102 | | - } |
103 | | - op = body.call(thisArg, _); |
104 | | - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } |
105 | | - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; |
106 | | - } |
| 29 | +/****************************************************************************** |
| 30 | +Copyright (c) Microsoft Corporation. |
| 31 | +
|
| 32 | +Permission to use, copy, modify, and/or distribute this software for any |
| 33 | +purpose with or without fee is hereby granted. |
| 34 | +
|
| 35 | +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH |
| 36 | +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY |
| 37 | +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, |
| 38 | +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM |
| 39 | +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR |
| 40 | +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 41 | +PERFORMANCE OF THIS SOFTWARE. |
| 42 | +***************************************************************************** */ |
| 43 | +/* global Reflect, Promise */ |
| 44 | + |
| 45 | +var extendStatics = function(d, b) { |
| 46 | + extendStatics = Object.setPrototypeOf || |
| 47 | + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || |
| 48 | + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; |
| 49 | + return extendStatics(d, b); |
| 50 | +}; |
| 51 | + |
| 52 | +function __extends(d, b) { |
| 53 | + if (typeof b !== "function" && b !== null) |
| 54 | + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); |
| 55 | + extendStatics(d, b); |
| 56 | + function __() { this.constructor = d; } |
| 57 | + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); |
| 58 | +} |
| 59 | + |
| 60 | +var __assign = function() { |
| 61 | + __assign = Object.assign || function __assign(t) { |
| 62 | + for (var s, i = 1, n = arguments.length; i < n; i++) { |
| 63 | + s = arguments[i]; |
| 64 | + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; |
| 65 | + } |
| 66 | + return t; |
| 67 | + }; |
| 68 | + return __assign.apply(this, arguments); |
| 69 | +}; |
| 70 | + |
| 71 | +function __awaiter(thisArg, _arguments, P, generator) { |
| 72 | + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } |
| 73 | + return new (P || (P = Promise))(function (resolve, reject) { |
| 74 | + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } |
| 75 | + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } |
| 76 | + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } |
| 77 | + step((generator = generator.apply(thisArg, _arguments || [])).next()); |
| 78 | + }); |
| 79 | +} |
| 80 | + |
| 81 | +function __generator(thisArg, body) { |
| 82 | + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; |
| 83 | + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; |
| 84 | + function verb(n) { return function (v) { return step([n, v]); }; } |
| 85 | + function step(op) { |
| 86 | + if (f) throw new TypeError("Generator is already executing."); |
| 87 | + while (_) try { |
| 88 | + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; |
| 89 | + if (y = 0, t) op = [op[0] & 2, t.value]; |
| 90 | + switch (op[0]) { |
| 91 | + case 0: case 1: t = op; break; |
| 92 | + case 4: _.label++; return { value: op[1], done: false }; |
| 93 | + case 5: _.label++; y = op[1]; op = [0]; continue; |
| 94 | + case 7: op = _.ops.pop(); _.trys.pop(); continue; |
| 95 | + default: |
| 96 | + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } |
| 97 | + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } |
| 98 | + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } |
| 99 | + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } |
| 100 | + if (t[2]) _.ops.pop(); |
| 101 | + _.trys.pop(); continue; |
| 102 | + } |
| 103 | + op = body.call(thisArg, _); |
| 104 | + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } |
| 105 | + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; |
| 106 | + } |
107 | 107 | } |
108 | 108 |
|
109 | 109 | /* eslint-disable @typescript-eslint/no-explicit-any,@typescript-eslint/explicit-module-boundary-types */ |
@@ -2415,7 +2415,7 @@ var GeometryNode = /** @class */ (function (_super) { |
2415 | 2415 | if (prev instanceof MoveTo || prev instanceof LineTo || prev instanceof CurveTo) { |
2416 | 2416 | if (curr instanceof CurveTo) { |
2417 | 2417 | hasStartMarker && |
2418 | | - markers.addMarker(new Marker(markerStart, [prev.x, prev.y], |
| 2418 | + markers.addMarker(new Marker(markerStart, [prev.x, prev.y], |
2419 | 2419 | // @ts-ignore |
2420 | 2420 | getAngle(last_1 ? [last_1.x, last_1.y] : [prev.x, prev.y], [curr.x1, curr.y1]), true)); |
2421 | 2421 | hasEndMarker && |
@@ -3133,7 +3133,7 @@ var TextNode = /** @class */ (function (_super) { |
3133 | 3133 | textChunks = []; |
3134 | 3134 | currentTextSegment = new TextChunk(this, context.attributeState.textAnchor, textX + dx, textY + dy); |
3135 | 3135 | textChunks.push({ type: '', chunk: currentTextSegment }); |
3136 | | - initialSpace = this.processTSpans(this, this.element, context, textChunks, currentTextSegment, |
| 3136 | + initialSpace = this.processTSpans(this, this.element, context, textChunks, currentTextSegment, |
3137 | 3137 | // Set prevText to ' ' so any spaces on left of <text> are trimmed |
3138 | 3138 | { prevText: ' ', prevContext: context }); |
3139 | 3139 | lengthAdjustment = initialSpace ? 0 : 1; |
@@ -5415,7 +5415,7 @@ var Anchor = /** @class */ (function (_super) { |
5415 | 5415 | box = this.getBoundingBox(context); |
5416 | 5416 | scale = context.pdf.internal.scaleFactor; |
5417 | 5417 | ph = context.pdf.internal.pageSize.getHeight(); |
5418 | | - context.pdf.link(scale * (box[0] * context.transform.sx + context.transform.tx), ph - scale * (box[1] * context.transform.sy + context.transform.ty), scale * box[2], scale * box[3], { url: href }); |
| 5418 | + context.pdf.link(scale * (box[0] * context.transform.sx + context.transform.tx), scale * (ph - box[1] * context.transform.sy - context.transform.ty), scale * context.transform.sx * box[2], scale * context.transform.sy * box[3], { url: href }); |
5419 | 5419 | } |
5420 | 5420 | return [2 /*return*/]; |
5421 | 5421 | } |
|
0 commit comments