@polotno/pdf-export 0.1.42 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +76 -112
- package/lib/browser.d.ts +102 -0
- package/lib/browser.js +3264 -0
- package/lib/data/Courier-Bold.afm +342 -0
- package/lib/data/Courier-BoldOblique.afm +342 -0
- package/lib/data/Courier-Oblique.afm +342 -0
- package/lib/data/Courier.afm +342 -0
- package/lib/data/Helvetica-Bold.afm +2827 -0
- package/lib/data/Helvetica-BoldOblique.afm +2827 -0
- package/lib/data/Helvetica-Oblique.afm +3051 -0
- package/lib/data/Helvetica.afm +3051 -0
- package/lib/data/Symbol.afm +213 -0
- package/lib/data/Times-Bold.afm +2588 -0
- package/lib/data/Times-BoldItalic.afm +2384 -0
- package/lib/data/Times-Italic.afm +2667 -0
- package/lib/data/Times-Roman.afm +2419 -0
- package/lib/data/ZapfDingbats.afm +225 -0
- package/lib/data/sRGB_IEC61966_2_1.icc +0 -0
- package/lib/index.d.ts +13 -1
- package/lib/index.js +196 -20
- package/package.json +49 -28
- package/patches/pdfkit+0.17.2.patch +0 -19
package/package.json
CHANGED
|
@@ -1,21 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@polotno/pdf-export",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Convert Polotno JSON into vector PDF",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
7
7
|
"types": "./lib/index.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"
|
|
11
|
-
"
|
|
10
|
+
"types": "./lib/index.d.ts",
|
|
11
|
+
"node": "./lib/index.js",
|
|
12
|
+
"default": "./lib/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./browser": {
|
|
15
|
+
"types": "./lib/browser.d.ts",
|
|
16
|
+
"browser": "./lib/browser.js",
|
|
17
|
+
"default": "./lib/browser.js"
|
|
12
18
|
}
|
|
13
19
|
},
|
|
20
|
+
"browser": {
|
|
21
|
+
"./lib/index.js": "./lib/browser.js"
|
|
22
|
+
},
|
|
14
23
|
"scripts": {
|
|
15
24
|
"build": "tsup",
|
|
16
25
|
"prepublishOnly": "npm run build",
|
|
17
|
-
"test": "vitest",
|
|
18
|
-
"test:
|
|
26
|
+
"test": "vitest --project node",
|
|
27
|
+
"test:browser": "npm run build && vitest run --project browser",
|
|
28
|
+
"test:update-snapshots": "vitest --project node -u",
|
|
19
29
|
"dev": "vite client",
|
|
20
30
|
"compare": "tsx scripts/compare-render.ts",
|
|
21
31
|
"postinstall": "patch-package"
|
|
@@ -23,39 +33,50 @@
|
|
|
23
33
|
"author": "Anton Lavrenov",
|
|
24
34
|
"files": [
|
|
25
35
|
"lib",
|
|
26
|
-
"README.md"
|
|
27
|
-
"patches"
|
|
36
|
+
"README.md"
|
|
28
37
|
],
|
|
29
38
|
"dependencies": {
|
|
30
39
|
"@xmldom/xmldom": "^0.9.10",
|
|
31
|
-
"canvas": "^3.2.
|
|
32
|
-
"file-type": "^
|
|
33
|
-
"gradient-parser": "^1.1.1",
|
|
34
|
-
"konva": "^10.0.9",
|
|
40
|
+
"canvas": "^3.2.3",
|
|
41
|
+
"file-type": "^22.0.1",
|
|
35
42
|
"linkedom": "^0.18.12",
|
|
36
|
-
"
|
|
37
|
-
"pdfkit": "^0.17.2",
|
|
38
|
-
"render-tag": "^0.1.6",
|
|
39
|
-
"sharp": "^0.34.5",
|
|
40
|
-
"svg-round-corners": "^0.4.3",
|
|
41
|
-
"svg-to-pdfkit": "^0.1.8"
|
|
43
|
+
"sharp": "^0.34.5"
|
|
42
44
|
},
|
|
43
45
|
"devDependencies": {
|
|
44
|
-
"@types/node": "^
|
|
45
|
-
"@types/pdfkit": "^0.17.
|
|
46
|
+
"@types/node": "^25.6.0",
|
|
47
|
+
"@types/pdfkit": "^0.17.6",
|
|
46
48
|
"@types/react": "18.3.12",
|
|
47
49
|
"@types/react-dom": "18.3.2",
|
|
48
|
-
"@
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
50
|
+
"@types/readable-stream": "^4.0.23",
|
|
51
|
+
"@vitejs/plugin-react": "^6.0.1",
|
|
52
|
+
"@vitest/browser": "^4.1.5",
|
|
53
|
+
"@vitest/browser-playwright": "^4.1.5",
|
|
54
|
+
"browserify-zlib": "^0.2.0",
|
|
55
|
+
"buffer": "^6.0.3",
|
|
56
|
+
"crypto-browserify": "^3.12.1",
|
|
57
|
+
"esbuild-plugin-polyfill-node": "^0.3.0",
|
|
58
|
+
"gradient-parser": "^1.2.0",
|
|
59
|
+
"jest-image-snapshot": "^6.5.2",
|
|
60
|
+
"konva": "^10.3.0",
|
|
61
|
+
"pako": "^2.1.0",
|
|
62
|
+
"patch-package": "^8.0.1",
|
|
63
|
+
"pdf-to-png-converter": "^4.0.0",
|
|
64
|
+
"pdfkit": "^0.18.0",
|
|
65
|
+
"pixelmatch": "^7.2.0",
|
|
66
|
+
"playwright": "^1.59.1",
|
|
52
67
|
"pngjs": "^7.0.0",
|
|
53
|
-
"polotno": "^2.
|
|
54
|
-
"polotno-node": "^2.15.
|
|
68
|
+
"polotno": "^2.40.2",
|
|
69
|
+
"polotno-node": "^2.15.18",
|
|
70
|
+
"process": "^0.11.10",
|
|
71
|
+
"readable-stream": "^4.7.0",
|
|
72
|
+
"render-tag": "^0.1.7",
|
|
73
|
+
"svg-round-corners": "^0.4.3",
|
|
74
|
+
"svg-to-pdfkit": "^0.1.8",
|
|
55
75
|
"tsup": "^8.5.1",
|
|
56
76
|
"tsx": "^4.21.0",
|
|
57
|
-
"typescript": "~
|
|
58
|
-
"vite": "^
|
|
59
|
-
"
|
|
77
|
+
"typescript": "~6.0.3",
|
|
78
|
+
"vite": "^8.0.10",
|
|
79
|
+
"vite-plugin-node-polyfills": "^0.26.0",
|
|
80
|
+
"vitest": "^4.1.5"
|
|
60
81
|
}
|
|
61
82
|
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
diff --git a/node_modules/pdfkit/js/pdfkit.js b/node_modules/pdfkit/js/pdfkit.js
|
|
2
|
-
index bba8028..66fd060 100644
|
|
3
|
-
--- a/node_modules/pdfkit/js/pdfkit.js
|
|
4
|
-
+++ b/node_modules/pdfkit/js/pdfkit.js
|
|
5
|
-
@@ -3423,7 +3423,13 @@ var TextMixin = {
|
|
6
|
-
}
|
|
7
|
-
const lineWidth = this._fontSize < 10 ? 0.5 : Math.floor(this._fontSize / 10);
|
|
8
|
-
this.lineWidth(lineWidth);
|
|
9
|
-
- let lineY = y + this.currentLineHeight() - lineWidth;
|
|
10
|
-
+ let lineY;
|
|
11
|
-
+ if (options.baseline === 'alphabetic') {
|
|
12
|
-
+ lineY = y + this.currentLineHeight() - lineWidth;
|
|
13
|
-
+ lineY -= (this._font.ascender / 1000) * this._fontSize
|
|
14
|
-
+ } else {
|
|
15
|
-
+ lineY = y + this.currentLineHeight() - lineWidth;
|
|
16
|
-
+ }
|
|
17
|
-
this.moveTo(x, lineY);
|
|
18
|
-
this.lineTo(x + renderedWidth, lineY);
|
|
19
|
-
this.stroke();
|