dom-to-vector-pdf 1.0.2 → 1.0.4
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.esm.js +0 -14
- package/dist/index.js +0 -14
- package/dist/index.umd.js +0 -14
- package/package.json +5 -1
package/dist/index.esm.js
CHANGED
|
@@ -177,48 +177,35 @@ class DomToPdfConverter {
|
|
|
177
177
|
this.setExportOptions(options);
|
|
178
178
|
// 1. Get and clone DOM element
|
|
179
179
|
const { element, parentElement } = this.prepareDomElement(options.selector);
|
|
180
|
-
console.log(1);
|
|
181
180
|
// Call lifecycle hook
|
|
182
181
|
hooks?.afterDomClone?.(element);
|
|
183
|
-
console.log(2);
|
|
184
182
|
// 2. Process SVG symbols
|
|
185
183
|
inlineSvgSymbols(element);
|
|
186
|
-
console.log(3);
|
|
187
184
|
// 3. Load resource
|
|
188
185
|
await this.loadResource(element);
|
|
189
|
-
console.log(4);
|
|
190
186
|
// 4. Convert to SVG
|
|
191
187
|
const svgDocument = elementToSVG(element);
|
|
192
188
|
parentElement?.removeChild(element);
|
|
193
|
-
console.log(5);
|
|
194
189
|
const svgElement = svgDocument.documentElement;
|
|
195
190
|
document.body.appendChild(svgElement);
|
|
196
191
|
this.prepareSvgElement(svgElement);
|
|
197
|
-
console.log(6);
|
|
198
192
|
// 5. Process SVG fonts
|
|
199
193
|
processSvgFonts(svgElement, this.fontManager);
|
|
200
|
-
console.log(7);
|
|
201
194
|
// Call lifecycle hook
|
|
202
195
|
hooks?.beforeSvgConvert?.(svgElement);
|
|
203
|
-
console.log(8);
|
|
204
196
|
// 6. Create PDF document
|
|
205
197
|
const pdf = this.createPdfDocument(svgElement);
|
|
206
198
|
this.fontManager.setPdfInstance(pdf);
|
|
207
|
-
console.log(9);
|
|
208
199
|
// 7. Draw SVG content to PDF
|
|
209
200
|
await this.renderSvgToPdf(svgElement, pdf);
|
|
210
|
-
console.log(10);
|
|
211
201
|
// Call lifecycle hook
|
|
212
202
|
hooks?.beforePdfGenerate?.(pdf);
|
|
213
203
|
hooks?.beforePdfSave?.(pdf);
|
|
214
|
-
console.log(11);
|
|
215
204
|
// 8. Save PDF
|
|
216
205
|
pdf.save(`${options.filename}.pdf`);
|
|
217
|
-
console.log(12);
|
|
218
206
|
// 9. Clean up temporary elements
|
|
219
207
|
svgElement.remove();
|
|
220
208
|
this.fontManager.setPdfInstance(null);
|
|
221
|
-
console.log(13);
|
|
222
209
|
}
|
|
223
210
|
catch (error) {
|
|
224
211
|
console.error('生成PDF失败:', error);
|
|
@@ -309,7 +296,6 @@ class DomToPdfConverter {
|
|
|
309
296
|
: this.exportOptions?.resourceTimeout);
|
|
310
297
|
}));
|
|
311
298
|
});
|
|
312
|
-
console.log(this.resourceQueue, 'this.resourceQueue');
|
|
313
299
|
return Promise.allSettled(this.resourceQueue);
|
|
314
300
|
}
|
|
315
301
|
}
|
package/dist/index.js
CHANGED
|
@@ -181,48 +181,35 @@ class DomToPdfConverter {
|
|
|
181
181
|
this.setExportOptions(options);
|
|
182
182
|
// 1. Get and clone DOM element
|
|
183
183
|
const { element, parentElement } = this.prepareDomElement(options.selector);
|
|
184
|
-
console.log(1);
|
|
185
184
|
// Call lifecycle hook
|
|
186
185
|
hooks?.afterDomClone?.(element);
|
|
187
|
-
console.log(2);
|
|
188
186
|
// 2. Process SVG symbols
|
|
189
187
|
inlineSvgSymbols(element);
|
|
190
|
-
console.log(3);
|
|
191
188
|
// 3. Load resource
|
|
192
189
|
await this.loadResource(element);
|
|
193
|
-
console.log(4);
|
|
194
190
|
// 4. Convert to SVG
|
|
195
191
|
const svgDocument = domToSvg.elementToSVG(element);
|
|
196
192
|
parentElement?.removeChild(element);
|
|
197
|
-
console.log(5);
|
|
198
193
|
const svgElement = svgDocument.documentElement;
|
|
199
194
|
document.body.appendChild(svgElement);
|
|
200
195
|
this.prepareSvgElement(svgElement);
|
|
201
|
-
console.log(6);
|
|
202
196
|
// 5. Process SVG fonts
|
|
203
197
|
processSvgFonts(svgElement, this.fontManager);
|
|
204
|
-
console.log(7);
|
|
205
198
|
// Call lifecycle hook
|
|
206
199
|
hooks?.beforeSvgConvert?.(svgElement);
|
|
207
|
-
console.log(8);
|
|
208
200
|
// 6. Create PDF document
|
|
209
201
|
const pdf = this.createPdfDocument(svgElement);
|
|
210
202
|
this.fontManager.setPdfInstance(pdf);
|
|
211
|
-
console.log(9);
|
|
212
203
|
// 7. Draw SVG content to PDF
|
|
213
204
|
await this.renderSvgToPdf(svgElement, pdf);
|
|
214
|
-
console.log(10);
|
|
215
205
|
// Call lifecycle hook
|
|
216
206
|
hooks?.beforePdfGenerate?.(pdf);
|
|
217
207
|
hooks?.beforePdfSave?.(pdf);
|
|
218
|
-
console.log(11);
|
|
219
208
|
// 8. Save PDF
|
|
220
209
|
pdf.save(`${options.filename}.pdf`);
|
|
221
|
-
console.log(12);
|
|
222
210
|
// 9. Clean up temporary elements
|
|
223
211
|
svgElement.remove();
|
|
224
212
|
this.fontManager.setPdfInstance(null);
|
|
225
|
-
console.log(13);
|
|
226
213
|
}
|
|
227
214
|
catch (error) {
|
|
228
215
|
console.error('生成PDF失败:', error);
|
|
@@ -313,7 +300,6 @@ class DomToPdfConverter {
|
|
|
313
300
|
: this.exportOptions?.resourceTimeout);
|
|
314
301
|
}));
|
|
315
302
|
});
|
|
316
|
-
console.log(this.resourceQueue, 'this.resourceQueue');
|
|
317
303
|
return Promise.allSettled(this.resourceQueue);
|
|
318
304
|
}
|
|
319
305
|
}
|
package/dist/index.umd.js
CHANGED
|
@@ -179,48 +179,35 @@
|
|
|
179
179
|
this.setExportOptions(options);
|
|
180
180
|
// 1. Get and clone DOM element
|
|
181
181
|
const { element, parentElement } = this.prepareDomElement(options.selector);
|
|
182
|
-
console.log(1);
|
|
183
182
|
// Call lifecycle hook
|
|
184
183
|
hooks?.afterDomClone?.(element);
|
|
185
|
-
console.log(2);
|
|
186
184
|
// 2. Process SVG symbols
|
|
187
185
|
inlineSvgSymbols(element);
|
|
188
|
-
console.log(3);
|
|
189
186
|
// 3. Load resource
|
|
190
187
|
await this.loadResource(element);
|
|
191
|
-
console.log(4);
|
|
192
188
|
// 4. Convert to SVG
|
|
193
189
|
const svgDocument = domToSvg.elementToSVG(element);
|
|
194
190
|
parentElement?.removeChild(element);
|
|
195
|
-
console.log(5);
|
|
196
191
|
const svgElement = svgDocument.documentElement;
|
|
197
192
|
document.body.appendChild(svgElement);
|
|
198
193
|
this.prepareSvgElement(svgElement);
|
|
199
|
-
console.log(6);
|
|
200
194
|
// 5. Process SVG fonts
|
|
201
195
|
processSvgFonts(svgElement, this.fontManager);
|
|
202
|
-
console.log(7);
|
|
203
196
|
// Call lifecycle hook
|
|
204
197
|
hooks?.beforeSvgConvert?.(svgElement);
|
|
205
|
-
console.log(8);
|
|
206
198
|
// 6. Create PDF document
|
|
207
199
|
const pdf = this.createPdfDocument(svgElement);
|
|
208
200
|
this.fontManager.setPdfInstance(pdf);
|
|
209
|
-
console.log(9);
|
|
210
201
|
// 7. Draw SVG content to PDF
|
|
211
202
|
await this.renderSvgToPdf(svgElement, pdf);
|
|
212
|
-
console.log(10);
|
|
213
203
|
// Call lifecycle hook
|
|
214
204
|
hooks?.beforePdfGenerate?.(pdf);
|
|
215
205
|
hooks?.beforePdfSave?.(pdf);
|
|
216
|
-
console.log(11);
|
|
217
206
|
// 8. Save PDF
|
|
218
207
|
pdf.save(`${options.filename}.pdf`);
|
|
219
|
-
console.log(12);
|
|
220
208
|
// 9. Clean up temporary elements
|
|
221
209
|
svgElement.remove();
|
|
222
210
|
this.fontManager.setPdfInstance(null);
|
|
223
|
-
console.log(13);
|
|
224
211
|
}
|
|
225
212
|
catch (error) {
|
|
226
213
|
console.error('生成PDF失败:', error);
|
|
@@ -311,7 +298,6 @@
|
|
|
311
298
|
: this.exportOptions?.resourceTimeout);
|
|
312
299
|
}));
|
|
313
300
|
});
|
|
314
|
-
console.log(this.resourceQueue, 'this.resourceQueue');
|
|
315
301
|
return Promise.allSettled(this.resourceQueue);
|
|
316
302
|
}
|
|
317
303
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dom-to-vector-pdf",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "xzboss"
|
|
6
6
|
},
|
|
@@ -39,6 +39,10 @@
|
|
|
39
39
|
"default": "./dist/index.esm.js"
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "https://github.com/xzboss/dom-to-vector-pdf.git"
|
|
45
|
+
},
|
|
42
46
|
"files": [
|
|
43
47
|
"dist/index.js",
|
|
44
48
|
"dist/index.esm.js",
|