@oiij/js-pdf 0.0.9 → 0.0.10
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/dist/index.mjs +13 -13
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -153,20 +153,20 @@ async function generatePDF(data, options, globalStyle) {
|
|
|
153
153
|
const font = pdf.getFont();
|
|
154
154
|
const { fontSize: _fontSize = pdf.getFontSize(), fontName: _fontName = font.fontName, fontStyle: _fontStyle = font.fontStyle, fontWeight: _fontWeight = "normal", textColor: _textColor = pdf.getTextColor() } = globalStyle ?? {};
|
|
155
155
|
const { drawColor: _drawColor = pdf.getDrawColor(), fillColor: _fillColor = pdf.getDrawColor(), charSpace: _charSpace = pdf.getCharSpace(), lineWidth: _lineWidth = pdf.getLineWidth(), style: _style = "S" } = globalStyle ?? {};
|
|
156
|
-
function setText(data
|
|
157
|
-
const { text, x, y, fontSize = _fontSize, fontName = _fontName, fontStyle = _fontStyle, fontWeight = _fontWeight, ...textOpt } = data
|
|
156
|
+
function setText(data) {
|
|
157
|
+
const { text, x, y, fontSize = _fontSize, fontName = _fontName, fontStyle = _fontStyle, fontWeight = _fontWeight, ...textOpt } = data;
|
|
158
158
|
pdf.setFontSize(fontSize);
|
|
159
159
|
pdf.setFont(fontName, fontStyle, fontWeight);
|
|
160
160
|
pdf.text(text, x, y, textOpt);
|
|
161
161
|
}
|
|
162
|
-
async function setImage(data
|
|
163
|
-
const { imageData, x, y, width, height, alias, compression, rotation } = data
|
|
162
|
+
async function setImage(data) {
|
|
163
|
+
const { imageData, x, y, width, height, alias, compression, rotation } = data;
|
|
164
164
|
const _imageData = typeof imageData === "function" ? await Promise.try(imageData) : imageData;
|
|
165
165
|
pdf.addImage(_imageData, x, y, width, height, alias, compression, rotation);
|
|
166
166
|
}
|
|
167
|
-
function setCircle(data
|
|
168
|
-
const { x, y, r } = data
|
|
169
|
-
const { fillColor = _fillColor, drawColor = _drawColor, lineWidth = _lineWidth, style = _style } = data
|
|
167
|
+
function setCircle(data) {
|
|
168
|
+
const { x, y, r } = data;
|
|
169
|
+
const { fillColor = _fillColor, drawColor = _drawColor, lineWidth = _lineWidth, style = _style } = data;
|
|
170
170
|
setDrawStyle(pdf, {
|
|
171
171
|
fillColor,
|
|
172
172
|
drawColor,
|
|
@@ -174,9 +174,9 @@ async function generatePDF(data, options, globalStyle) {
|
|
|
174
174
|
});
|
|
175
175
|
pdf.circle(x, y, r, style);
|
|
176
176
|
}
|
|
177
|
-
function setLine(data
|
|
178
|
-
const { x1, y1, x2, y2 } = data
|
|
179
|
-
const { fillColor = _fillColor, drawColor = _drawColor, lineWidth = _lineWidth, style = _style } = data
|
|
177
|
+
function setLine(data) {
|
|
178
|
+
const { x1, y1, x2, y2 } = data;
|
|
179
|
+
const { fillColor = _fillColor, drawColor = _drawColor, lineWidth = _lineWidth, style = _style } = data;
|
|
180
180
|
setDrawStyle(pdf, {
|
|
181
181
|
fillColor,
|
|
182
182
|
drawColor,
|
|
@@ -184,9 +184,9 @@ async function generatePDF(data, options, globalStyle) {
|
|
|
184
184
|
});
|
|
185
185
|
pdf.line(x1, y1, x2, y2, style);
|
|
186
186
|
}
|
|
187
|
-
function setLines(data
|
|
188
|
-
const { lines, x, y, scale = [1, 1], closed = false } = data
|
|
189
|
-
const { fillColor = _fillColor, drawColor = _drawColor, lineWidth = _lineWidth, style = _style } = data
|
|
187
|
+
function setLines(data) {
|
|
188
|
+
const { lines, x, y, scale = [1, 1], closed = false } = data;
|
|
189
|
+
const { fillColor = _fillColor, drawColor = _drawColor, lineWidth = _lineWidth, style = _style } = data;
|
|
190
190
|
setDrawStyle(pdf, {
|
|
191
191
|
fillColor,
|
|
192
192
|
drawColor,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oiij/js-pdf",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.10",
|
|
5
5
|
"description": "A simple PDF library for JavaScript",
|
|
6
6
|
"author": "oiij",
|
|
7
7
|
"license": "MIT",
|
|
@@ -28,18 +28,18 @@
|
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"@types/file-saver": "^2.0.7",
|
|
30
30
|
"file-saver": "^2.0.5",
|
|
31
|
-
"jspdf": "^
|
|
31
|
+
"jspdf": "^4.0.0",
|
|
32
32
|
"jszip": "^3.10.1",
|
|
33
33
|
"nanoid": "^5.1.6",
|
|
34
|
-
"pdfjs-dist": "^5.4.
|
|
34
|
+
"pdfjs-dist": "^5.4.530"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/file-saver": "^2.0.7",
|
|
38
38
|
"file-saver": "^2.0.5",
|
|
39
|
-
"jspdf": "^
|
|
39
|
+
"jspdf": "^4.0.0",
|
|
40
40
|
"jszip": "^3.10.1",
|
|
41
41
|
"nanoid": "^5.1.6",
|
|
42
|
-
"pdfjs-dist": "^5.4.
|
|
42
|
+
"pdfjs-dist": "^5.4.530"
|
|
43
43
|
},
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|