p3x-html-pdf 2025.4.159 → 2025.4.162

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.
Files changed (2) hide show
  1. package/README.md +85 -23
  2. 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.159
9
+ # 📃 Generates PDF from HTML with custom headers and footers with wkhtmltopdf v2025.4.162
10
10
 
11
11
 
12
12
 
@@ -78,48 +78,110 @@ const path = require('path');
78
78
  save: true,
79
79
  template: {
80
80
  format: 'A4',
81
- orientation: 'portrait',
82
81
  marginLeft: 10,
83
82
  marginRight: 10,
83
+ fixedWidth: null,
84
+ fixedHeight: null,
85
+ copies: 1,
86
+ orientation: 'portrait',
84
87
  },
85
88
  html: `
86
- <div id="p3x-header" data-height="20mm">
87
- <h1>Header Content</h1>
89
+ <div id="p3x-header-1" data-height="40mm">
90
+ <div style="width: 100%; padding: 0px; display: table;">
91
+ <div style="display: table-cell; vertical-align: middle;">
92
+ <img src="http://cdn.corifeus.com/assets/png/patrikx3.png" alt="Header Logo" style="height:40mm; margin:0;"/>
93
+ </div>
94
+ <div style="display: table-cell; vertical-align: middle; text-align: right; width: 100%;">
95
+ <h1 style="margin: 0; font-size: 20px; color: #333;">P3X HTML Invoice - First Page</h1>
96
+ <p style="margin: 5px 0 0; font-size: 14px; color: #555;">Generated: ${new Date().toLocaleDateString()}</p>
97
+ </div>
98
+ </div>
99
+ </div>
100
+ <div id="p3x-header" data-height="40mm" >
101
+ <div style="display: table; width: 100%; height: 40mm; text-align: right;">
102
+ <div style="display: table-cell; vertical-align: middle; text-align: right;">
103
+ <h1 style="margin: 0; font-size: 20px; color: #333;">P3X HTML Invoice </h1>
104
+ </div>
105
+ </div>
88
106
  </div>
89
- <div id="p3x-footer" data-height="15mm">
90
- <p>Page \${page} of \${pages}</p>
107
+ <div id="p3x-header-last" data-height="40mm" >
108
+ <div style="display: table; width: 100%; height: 40mm; text-align: right;">
109
+ <div style="display: table-cell; vertical-align: middle; text-align: right;">
110
+ <h1 style="margin: 0; font-size: 20px; color: #333;">P3X HTML Final Notes </h1>
111
+ </div>
112
+ </div>
113
+ </div>
114
+ <div id="p3x-footer" data-height="10mm">
115
+ <div style="text-align: right; font-size: 12px; color: #777;">
116
+ Page \${page} of \${pages}
117
+ </div>
118
+ </div>
119
+ <div id="p3x-footer-last" data-height="10mm">
120
+ <div style="text-align: right; font-size: 12px; color: #777;">
121
+ Final \${page} of \${pages}
122
+ </div>
91
123
  </div>
92
124
  <div>
93
- <h2>Content</h2>
94
- <p>This is a test PDF document.</p>
95
- <table width="100%" align="left" border="1">
125
+ <h2 style="color: #222;">Invoice Content</h2>
126
+ <p style="font-size: 14px; color: #555;">This invoice showcases structured content on a single page for detailed clarity.</p>
127
+ <table style="width:100%; border-collapse: collapse; margin: 10px 0; font-size: 14px;">
128
+ <tr>
129
+ <th style="border: 1px solid #ddd; padding: 8px; background-color: #f4f4f4;">Item</th>
130
+ <th style="border: 1px solid #ddd; padding: 8px; background-color: #f4f4f4;">Quantity</th>
131
+ <th style="border: 1px solid #ddd; padding: 8px; background-color: #f4f4f4;">Price</th>
132
+ <th style="border: 1px solid #ddd; padding: 8px; background-color: #f4f4f4;">Total</th>
133
+ </tr>
134
+ ${Array.from({ length: 26 }).map((_, i) => {
135
+ const price = (i + 1) * 10;
136
+ const quantity = (i % 5) + 1;
137
+ const total = price * quantity;
138
+ return `<tr>
139
+ <td style="border: 1px solid #ddd; padding: 8px;">Product ${String.fromCharCode(65 + (i % 26))}</td>
140
+ <td style="border: 1px solid #ddd; padding: 8px; text-align: right;">${quantity}</td>
141
+ <td style="border: 1px solid #ddd; padding: 8px; text-align: right;">$${price}.00</td>
142
+ <td style="border: 1px solid #ddd; padding: 8px; text-align: right;">$${total}.00</td>
143
+ </tr>`;
144
+ }).join('')}
96
145
  <tr>
97
- <th align="left">Header 1</th>
98
- <th align="left">Header 2</th>
99
- <th align="left">Header 3</th>
146
+ <td colspan="3" style="border: 1px solid #ddd; padding: 8px; text-align: right; font-weight: bold;">Subtotal</td>
147
+ <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>
100
148
  </tr>
101
149
  <tr>
102
- <td>Data 1</td>
103
- <td>Data 2</td>
104
- <td>Data 3</td>
150
+ <td colspan="3" style="border: 1px solid #ddd; padding: 8px; text-align: right; font-weight: bold;">VAT (20%)</td>
151
+ <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>
105
152
  </tr>
106
153
  <tr>
107
- <td>Data 4</td>
108
- <td>Data 5</td>
109
- <td>Data 6</td>
154
+ <td colspan="3" style="border: 1px solid #ddd; padding: 8px; text-align: right; font-weight: bold;">Total</td>
155
+ <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
156
  </tr>
111
157
  </table>
112
158
  </div>
113
- `,
159
+ <div class="ng-template-page-break"></div>
160
+ <div>
161
+ <h2 style="color: #222;">Additional Information</h2>
162
+ <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>
163
+ <ul style="font-size: 14px; color: #555;">
164
+ <li>Payments are due within 30 days of receipt.</li>
165
+ <li>Accepted payment methods include credit card, bank transfer, and PayPal.</li>
166
+ <li>Please ensure that all transactions reference the invoice number provided above.</li>
167
+ </ul>
168
+ <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>
169
+ </div>
170
+ <div class="ng-template-page-break"></div>
171
+ <div>
172
+ <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>
173
+ </div>
174
+ `,
114
175
  },
115
- title: 'Sample PDF',
116
- saveFile: path.resolve(__dirname, 'output.pdf'),
176
+ title: 'P3X-HTML-PDF Detailed Invoice',
177
+ debug: true,
178
+ saveFile: outputPath,
117
179
  };
118
180
 
119
181
  try {
120
182
  await generate(options);
121
183
  console.log('✅ PDF generated successfully!');
122
- // or options.save = false
184
+ // or options.settings.save = false
123
185
  const buffer = await generate(options);
124
186
  } catch (err) {
125
187
  console.error('❌ Error generating PDF:', err);
@@ -518,7 +580,7 @@ All my domains, including [patrikx3.com](https://patrikx3.com), [corifeus.eu](ht
518
580
  ---
519
581
 
520
582
 
521
- [**P3X-HTML-PDF**](https://corifeus.com/html-pdf) Build v2025.4.159
583
+ [**P3X-HTML-PDF**](https://corifeus.com/html-pdf) Build v2025.4.162
522
584
 
523
585
  [![NPM](https://img.shields.io/npm/v/p3x-html-pdf.svg)](https://www.npmjs.com/package/p3x-html-pdf) [![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact) [![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software)
524
586
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "p3x-html-pdf",
3
- "version": "2025.4.159",
3
+ "version": "2025.4.162",
4
4
  "corifeus": {
5
5
  "prefix": "p3x-",
6
6
  "publish": true,