pdf-gen-js 1.0.0 → 1.1.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 +16 -0
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -108,6 +108,22 @@ await pdf.useTemplate('invoice', {
|
|
|
108
108
|
|
|
109
109
|
WEBP is transparently normalized to PNG via `sharp` (PDFKit has no native WEBP support). SVG is drawn as true vector paths via `svg-to-pdfkit` — not rasterized — so it stays crisp. See [Logos & Images in the root README](../../README.md#logos--images) for the full picture, including a side-by-side comparison of all four formats.
|
|
110
110
|
|
|
111
|
+
## Custom templates — build your own design
|
|
112
|
+
|
|
113
|
+
Not limited to invoice/receipt/certificate — register any renderer function under any name:
|
|
114
|
+
|
|
115
|
+
```javascript
|
|
116
|
+
pdf.registerTemplate('businessCard', (doc, config, data, theme) => {
|
|
117
|
+
// doc is the raw PDFKit document — full API available
|
|
118
|
+
doc.roundedRect(50, 50, 300, 150, 10).fill(theme.primary);
|
|
119
|
+
doc.fillColor(theme.accent).font('Helvetica-Bold').fontSize(18).text(data.name, 70, 80);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
await pdf.useTemplate('businessCard', { name: 'Jane Doe' });
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
See [Custom Templates in the root README](../../README.md#custom-templates--build-your-own-design) for a full runnable example and screenshot.
|
|
126
|
+
|
|
111
127
|
## CLI Usage
|
|
112
128
|
|
|
113
129
|
```bash
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pdf-gen-js",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "JavaScript/TypeScript PDF generation with templates",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -41,7 +41,11 @@
|
|
|
41
41
|
"generation",
|
|
42
42
|
"templates",
|
|
43
43
|
"invoice",
|
|
44
|
-
"certificate"
|
|
44
|
+
"certificate",
|
|
45
|
+
"receipt",
|
|
46
|
+
"logo",
|
|
47
|
+
"svg",
|
|
48
|
+
"webp"
|
|
45
49
|
],
|
|
46
50
|
"author": "Ahmed Fayyaz",
|
|
47
51
|
"license": "MIT"
|