p3x-html-pdf 2025.4.161 → 2025.4.163
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 +86 -22
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
# 📃 Generates PDF from HTML with custom headers and footers with wkhtmltopdf v2025.4.
|
|
9
|
+
# 📃 Generates PDF from HTML with custom headers and footers with wkhtmltopdf v2025.4.163
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
@@ -73,47 +73,111 @@ const { generate } = require('p3x-html-pdf');
|
|
|
73
73
|
const path = require('path');
|
|
74
74
|
|
|
75
75
|
(async () => {
|
|
76
|
+
const outputPath = path.join(process.cwd(), 'p3x-html-pdf-output.pdf');
|
|
77
|
+
|
|
76
78
|
const options = {
|
|
77
79
|
settings: {
|
|
78
80
|
save: true,
|
|
79
81
|
template: {
|
|
80
82
|
format: 'A4',
|
|
81
|
-
orientation: 'portrait',
|
|
82
83
|
marginLeft: 10,
|
|
83
84
|
marginRight: 10,
|
|
85
|
+
fixedWidth: null,
|
|
86
|
+
fixedHeight: null,
|
|
87
|
+
copies: 1,
|
|
88
|
+
orientation: 'portrait',
|
|
84
89
|
},
|
|
85
90
|
html: `
|
|
86
|
-
<div id="p3x-header" data-height="
|
|
87
|
-
<
|
|
91
|
+
<div id="p3x-header-1" data-height="40mm">
|
|
92
|
+
<div style="width: 100%; padding: 0px; display: table;">
|
|
93
|
+
<div style="display: table-cell; vertical-align: middle;">
|
|
94
|
+
<img src="http://cdn.corifeus.com/assets/png/patrikx3.png" alt="Header Logo" style="height:40mm; margin:0;"/>
|
|
95
|
+
</div>
|
|
96
|
+
<div style="display: table-cell; vertical-align: middle; text-align: right; width: 100%;">
|
|
97
|
+
<h1 style="margin: 0; font-size: 20px; color: #333;">P3X HTML Invoice - First Page</h1>
|
|
98
|
+
<p style="margin: 5px 0 0; font-size: 14px; color: #555;">Generated: ${new Date().toLocaleDateString()}</p>
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
<div id="p3x-header" data-height="40mm" >
|
|
103
|
+
<div style="display: table; width: 100%; height: 40mm; text-align: right;">
|
|
104
|
+
<div style="display: table-cell; vertical-align: middle; text-align: right;">
|
|
105
|
+
<h1 style="margin: 0; font-size: 20px; color: #333;">P3X HTML Invoice </h1>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
88
108
|
</div>
|
|
89
|
-
<div id="p3x-
|
|
90
|
-
<
|
|
109
|
+
<div id="p3x-header-last" data-height="40mm" >
|
|
110
|
+
<div style="display: table; width: 100%; height: 40mm; text-align: right;">
|
|
111
|
+
<div style="display: table-cell; vertical-align: middle; text-align: right;">
|
|
112
|
+
<h1 style="margin: 0; font-size: 20px; color: #333;">P3X HTML Final Notes </h1>
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
</div>
|
|
116
|
+
<div id="p3x-footer" data-height="10mm">
|
|
117
|
+
<div style="text-align: right; font-size: 12px; color: #777;">
|
|
118
|
+
Page \${page} of \${pages}
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
<div id="p3x-footer-last" data-height="10mm">
|
|
122
|
+
<div style="text-align: right; font-size: 12px; color: #777;">
|
|
123
|
+
Final \${page} of \${pages}
|
|
124
|
+
</div>
|
|
91
125
|
</div>
|
|
92
126
|
<div>
|
|
93
|
-
<h2>Content</h2>
|
|
94
|
-
<p>This
|
|
95
|
-
<table
|
|
127
|
+
<h2 style="color: #222;">Invoice Content</h2>
|
|
128
|
+
<p style="font-size: 14px; color: #555;">This invoice showcases structured content on a single page for detailed clarity.</p>
|
|
129
|
+
<table style="width:100%; border-collapse: collapse; margin: 10px 0; font-size: 14px;">
|
|
96
130
|
<tr>
|
|
97
|
-
<th
|
|
98
|
-
<th
|
|
99
|
-
<th
|
|
131
|
+
<th style="border: 1px solid #ddd; padding: 8px; background-color: #f4f4f4;">Item</th>
|
|
132
|
+
<th style="border: 1px solid #ddd; padding: 8px; background-color: #f4f4f4;">Quantity</th>
|
|
133
|
+
<th style="border: 1px solid #ddd; padding: 8px; background-color: #f4f4f4;">Price</th>
|
|
134
|
+
<th style="border: 1px solid #ddd; padding: 8px; background-color: #f4f4f4;">Total</th>
|
|
100
135
|
</tr>
|
|
136
|
+
${Array.from({ length: 26 }).map((_, i) => {
|
|
137
|
+
const price = (i + 1) * 10;
|
|
138
|
+
const quantity = (i % 5) + 1;
|
|
139
|
+
const total = price * quantity;
|
|
140
|
+
return `<tr>
|
|
141
|
+
<td style="border: 1px solid #ddd; padding: 8px;">Product ${String.fromCharCode(65 + (i % 26))}</td>
|
|
142
|
+
<td style="border: 1px solid #ddd; padding: 8px; text-align: right;">${quantity}</td>
|
|
143
|
+
<td style="border: 1px solid #ddd; padding: 8px; text-align: right;">$${price}.00</td>
|
|
144
|
+
<td style="border: 1px solid #ddd; padding: 8px; text-align: right;">$${total}.00</td>
|
|
145
|
+
</tr>`;
|
|
146
|
+
}).join('')}
|
|
101
147
|
<tr>
|
|
102
|
-
<td>
|
|
103
|
-
<td
|
|
104
|
-
<td>Data 3</td>
|
|
148
|
+
<td colspan="3" style="border: 1px solid #ddd; padding: 8px; text-align: right; font-weight: bold;">Subtotal</td>
|
|
149
|
+
<td style="border: 1px solid #ddd; padding: 8px; text-align: right; font-weight: bold;">$${Array.from({ length: 15 }).reduce((acc, _, i) => acc + ((i + 1) * 10 * ((i % 5) + 1)), 0)}.00</td>
|
|
105
150
|
</tr>
|
|
106
151
|
<tr>
|
|
107
|
-
<td>
|
|
108
|
-
<td
|
|
109
|
-
|
|
152
|
+
<td colspan="3" style="border: 1px solid #ddd; padding: 8px; text-align: right; font-weight: bold;">VAT (20%)</td>
|
|
153
|
+
<td style="border: 1px solid #ddd; padding: 8px; text-align: right; font-weight: bold;">$${(Array.from({ length: 15 }).reduce((acc, _, i) => acc + ((i + 1) * 10 * ((i % 5) + 1)), 0) * 0.2).toFixed(2)}</td>
|
|
154
|
+
</tr>
|
|
155
|
+
<tr>
|
|
156
|
+
<td colspan="3" style="border: 1px solid #ddd; padding: 8px; text-align: right; font-weight: bold;">Total</td>
|
|
157
|
+
<td style="border: 1px solid #ddd; padding: 8px; text-align: right; font-weight: bold;">$${(Array.from({ length: 15 }).reduce((acc, _, i) => acc + ((i + 1) * 10 * ((i % 5) + 1)), 0) * 1.2).toFixed(2)}</td>
|
|
110
158
|
</tr>
|
|
111
159
|
</table>
|
|
112
160
|
</div>
|
|
113
|
-
|
|
161
|
+
<div class="ng-template-page-break"></div>
|
|
162
|
+
<div>
|
|
163
|
+
<h2 style="color: #222;">Additional Information</h2>
|
|
164
|
+
<p style="font-size: 14px; color: #555;">This page provides further details about the invoice, payment methods, and terms. Below is a breakdown of important notes:</p>
|
|
165
|
+
<ul style="font-size: 14px; color: #555;">
|
|
166
|
+
<li>Payments are due within 30 days of receipt.</li>
|
|
167
|
+
<li>Accepted payment methods include credit card, bank transfer, and PayPal.</li>
|
|
168
|
+
<li>Please ensure that all transactions reference the invoice number provided above.</li>
|
|
169
|
+
</ul>
|
|
170
|
+
<p style="font-size: 14px; color: #555;">If you have any questions, feel free to contact our support team at <a href="mailto:support@patrikx3.com">support@patrikx3.com</a>.</p>
|
|
171
|
+
</div>
|
|
172
|
+
<div class="ng-template-page-break"></div>
|
|
173
|
+
<div>
|
|
174
|
+
<p style="font-size: 14px; color: #555;">Thank you for your business! We hope to work with you again in the future. Stay tuned for updates on our services and offerings by visiting our website or subscribing to our newsletter.</p>
|
|
175
|
+
</div>
|
|
176
|
+
`,
|
|
114
177
|
},
|
|
115
|
-
title: '
|
|
116
|
-
|
|
178
|
+
title: 'P3X-HTML-PDF Detailed Invoice',
|
|
179
|
+
debug: true,
|
|
180
|
+
saveFile: outputPath,
|
|
117
181
|
};
|
|
118
182
|
|
|
119
183
|
try {
|
|
@@ -518,7 +582,7 @@ All my domains, including [patrikx3.com](https://patrikx3.com), [corifeus.eu](ht
|
|
|
518
582
|
---
|
|
519
583
|
|
|
520
584
|
|
|
521
|
-
[**P3X-HTML-PDF**](https://corifeus.com/html-pdf) Build v2025.4.
|
|
585
|
+
[**P3X-HTML-PDF**](https://corifeus.com/html-pdf) Build v2025.4.163
|
|
522
586
|
|
|
523
587
|
[](https://www.npmjs.com/package/p3x-html-pdf) [](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [](https://www.patrikx3.com/en/front/contact) [](https://www.facebook.com/corifeus.software)
|
|
524
588
|
|