@oiij/js-pdf 0.0.8 → 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.d.mts CHANGED
@@ -19,20 +19,20 @@ declare function readPdfFile(buffer: ArrayBuffer): Promise<{
19
19
  //#endregion
20
20
  //#region src/index.d.ts
21
21
  type Color = string | [number, number, number, number];
22
- interface TextStyle {
22
+ type TextStyle = {
23
23
  fontSize?: number;
24
24
  fontName?: string;
25
25
  fontStyle?: HTMLFontFace['style'];
26
26
  fontWeight?: HTMLFontFace['weight'];
27
27
  textColor?: Color;
28
- }
29
- interface DrawStyle {
28
+ };
29
+ type DrawStyle = {
30
30
  drawColor?: Color;
31
31
  fillColor?: Color;
32
32
  charSpace?: number;
33
33
  lineWidth?: number;
34
34
  style?: 'S' | 'F' | 'FD' | 'DF' | null;
35
- }
35
+ };
36
36
  type PDFStyle = TextStyle & DrawStyle & {};
37
37
  type PDFDataType = 'text' | 'image' | 'circle' | 'line' | 'lines';
38
38
  type OTextOptions = TextOptions & TextStyle;
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$1) {
157
- const { text, x, y, fontSize = _fontSize, fontName = _fontName, fontStyle = _fontStyle, fontWeight = _fontWeight, ...textOpt } = data$1;
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$1) {
163
- const { imageData, x, y, width, height, alias, compression, rotation } = data$1;
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$1) {
168
- const { x, y, r } = data$1;
169
- const { fillColor = _fillColor, drawColor = _drawColor, lineWidth = _lineWidth, style = _style } = data$1;
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$1) {
178
- const { x1, y1, x2, y2 } = data$1;
179
- const { fillColor = _fillColor, drawColor = _drawColor, lineWidth = _lineWidth, style = _style } = data$1;
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$1) {
188
- const { lines, x, y, scale = [1, 1], closed = false } = data$1;
189
- const { fillColor = _fillColor, drawColor = _drawColor, lineWidth = _lineWidth, style = _style } = data$1;
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.8",
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": "^3.0.4",
31
+ "jspdf": "^4.0.0",
32
32
  "jszip": "^3.10.1",
33
33
  "nanoid": "^5.1.6",
34
- "pdfjs-dist": "^5.4.449"
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": "^3.0.4",
39
+ "jspdf": "^4.0.0",
40
40
  "jszip": "^3.10.1",
41
41
  "nanoid": "^5.1.6",
42
- "pdfjs-dist": "^5.4.449"
42
+ "pdfjs-dist": "^5.4.530"
43
43
  },
44
44
  "publishConfig": {
45
45
  "access": "public"