p3x-html-pdf 2025.4.164 โ 2025.4.166
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 +34 -4
- package/package.json +1 -1
- package/test/test.js +8 -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.166
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
@@ -176,15 +176,20 @@ const path = require('path');
|
|
|
176
176
|
`,
|
|
177
177
|
},
|
|
178
178
|
title: 'P3X-HTML-PDF Detailed Invoice',
|
|
179
|
-
debug:
|
|
179
|
+
debug: false,
|
|
180
180
|
saveFile: outputPath,
|
|
181
181
|
};
|
|
182
182
|
|
|
183
183
|
try {
|
|
184
184
|
await generate(options);
|
|
185
185
|
console.log('โ
PDF generated successfully!');
|
|
186
|
-
|
|
186
|
+
|
|
187
|
+
// or
|
|
188
|
+
options.settings.save = false
|
|
187
189
|
const buffer = await generate(options);
|
|
190
|
+
console.log('--------------------------------------------------------------')
|
|
191
|
+
console.log('PDF Buffer:', buffer);
|
|
192
|
+
|
|
188
193
|
} catch (err) {
|
|
189
194
|
console.error('โ Error generating PDF:', err);
|
|
190
195
|
}
|
|
@@ -216,6 +221,31 @@ For more options, check the official [wkhtmltopdf usage guide](https://wkhtmltop
|
|
|
216
221
|
|
|
217
222
|
Unfortunately the version latest HTTPS TLS 1.3 is not working, so it is better to use inline filesystem images or using HTTP as that is dated but still works.
|
|
218
223
|
|
|
224
|
+
### How to Add a Page Break with `p3x-html-pdf`
|
|
225
|
+
|
|
226
|
+
To insert a page break, simply use the following snippet:
|
|
227
|
+
|
|
228
|
+
```html
|
|
229
|
+
<div class="p3x-template-page-break"></div>
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
#### โ
Key Points:
|
|
233
|
+
- ๐ง **No additional CSS** is required; the functionality is built-in.
|
|
234
|
+
- ๐ The content after this `<div>` will automatically start on a new page.
|
|
235
|
+
- ๐งน Ensure your HTML structure is clean for proper rendering.
|
|
236
|
+
|
|
237
|
+
#### ๐ Example:
|
|
238
|
+
```html
|
|
239
|
+
<div>
|
|
240
|
+
<p>๐ This content will be on the first page.</p>
|
|
241
|
+
</div>
|
|
242
|
+
|
|
243
|
+
<div class="p3x-template-page-break"></div>
|
|
244
|
+
|
|
245
|
+
<div>
|
|
246
|
+
<p>๐ This content will appear on the next page.</p>
|
|
247
|
+
</div>
|
|
248
|
+
```
|
|
219
249
|
---
|
|
220
250
|
|
|
221
251
|
## ๐ Placeholders
|
|
@@ -582,7 +612,7 @@ All my domains, including [patrikx3.com](https://patrikx3.com), [corifeus.eu](ht
|
|
|
582
612
|
---
|
|
583
613
|
|
|
584
614
|
|
|
585
|
-
[**P3X-HTML-PDF**](https://corifeus.com/html-pdf) Build v2025.4.
|
|
615
|
+
[**P3X-HTML-PDF**](https://corifeus.com/html-pdf) Build v2025.4.166
|
|
586
616
|
|
|
587
617
|
[](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)
|
|
588
618
|
|
package/package.json
CHANGED
package/test/test.js
CHANGED
|
@@ -122,13 +122,20 @@ const fs = require('fs');
|
|
|
122
122
|
`,
|
|
123
123
|
},
|
|
124
124
|
title: 'P3X-HTML-PDF Detailed Invoice',
|
|
125
|
-
debug:
|
|
125
|
+
debug: false,
|
|
126
126
|
saveFile: outputPath,
|
|
127
127
|
};
|
|
128
128
|
|
|
129
129
|
// Generate the PDF
|
|
130
130
|
await generate(options);
|
|
131
131
|
|
|
132
|
+
options.settings.save = false;
|
|
133
|
+
|
|
134
|
+
const buffer = await generate(options);
|
|
135
|
+
|
|
136
|
+
console.log('--------------------------------------------------------------')
|
|
137
|
+
console.log('PDF Buffer:', buffer);
|
|
138
|
+
|
|
132
139
|
console.log('PDF generation successful! Check test-output.pdf.');
|
|
133
140
|
} catch (error) {
|
|
134
141
|
console.error('PDF generation failed:', error);
|