p3x-html-pdf 2025.4.155 → 2025.4.156
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 +3 -3
- package/package.json +1 -1
- package/src/header-footer.html +7 -5
- package/test/test.js +13 -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.156
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
@@ -315,7 +315,7 @@ When designing headers and footers:
|
|
|
315
315
|
`p3x-html-pdf` supports indexed headers and footers, allowing unique designs for specific pages. For example, `p3x-header-1` can define a header for the first page, while `p3x-header` applies to subsequent pages. Similarly, `p3x-footer-1` can be used for a custom first-page footer.
|
|
316
316
|
|
|
317
317
|
##### Key Points:
|
|
318
|
-
1. **Indexed IDs**: Use `p3x-header-1`, `p3x-footer-1`, etc., for specific pages. Default headers (`p3x-header`) and footers (`p3x-footer`) are used when no specific index is found
|
|
318
|
+
1. **Indexed IDs**: Use `p3x-header-1`, `p3x-footer-1`, etc., for specific pages. Default headers (`p3x-header`) and footers (`p3x-footer`) are used when no specific index is found and there is `p3x-header-last` or `p3x-footer-last`.
|
|
319
319
|
2. **Consistent Heights**: All headers and footers must share the same `data-height` (e.g., `40mm` for headers, `10mm` for footers) to ensure proper alignment and accurate page calculations.
|
|
320
320
|
3. **Dynamic Content**: Use placeholders like `${page}` and `${pages}` to display page-specific data dynamically.
|
|
321
321
|
|
|
@@ -509,7 +509,7 @@ All my domains, including [patrikx3.com](https://patrikx3.com), [corifeus.eu](ht
|
|
|
509
509
|
---
|
|
510
510
|
|
|
511
511
|
|
|
512
|
-
[**P3X-HTML-PDF**](https://corifeus.com/html-pdf) Build v2025.4.
|
|
512
|
+
[**P3X-HTML-PDF**](https://corifeus.com/html-pdf) Build v2025.4.156
|
|
513
513
|
|
|
514
514
|
[](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)
|
|
515
515
|
|
package/package.json
CHANGED
package/src/header-footer.html
CHANGED
|
@@ -30,14 +30,16 @@
|
|
|
30
30
|
<body>
|
|
31
31
|
|
|
32
32
|
<script>
|
|
33
|
-
var itemName = baseSelector + '-' + vars.page;
|
|
33
|
+
var itemName = baseSelector + '-' + vars.page; // Default: current page-specific header/footer
|
|
34
|
+
if (vars.page == vars.pages) { // Check if it's the last page
|
|
35
|
+
itemName = baseSelector + '-last'; // Use the last page-specific header/footer
|
|
36
|
+
} else if (!items.hasOwnProperty(itemName)) { // Fallback to the default header/footer
|
|
37
|
+
itemName = baseSelector;
|
|
38
|
+
}
|
|
34
39
|
var item = '';
|
|
35
40
|
if (items.hasOwnProperty(itemName)) {
|
|
36
|
-
item = items[itemName]
|
|
37
|
-
} else {
|
|
38
|
-
item = items[baseSelector];
|
|
41
|
+
item = items[itemName];
|
|
39
42
|
}
|
|
40
|
-
;
|
|
41
43
|
// lodash-template-hack //
|
|
42
44
|
var $item = $(item);
|
|
43
45
|
var $body = $('body');
|
package/test/test.js
CHANGED
|
@@ -53,11 +53,24 @@ const fs = require('fs');
|
|
|
53
53
|
</div>
|
|
54
54
|
</div>
|
|
55
55
|
</div>
|
|
56
|
+
<div id="p3x-header-last" data-height="40mm" >
|
|
57
|
+
<div style="display: table; width: 100%; height: 40mm; text-align: right;">
|
|
58
|
+
<div style="display: table-cell; vertical-align: middle; text-align: right;">
|
|
59
|
+
<h1 style="margin: 0; font-size: 20px; color: #333;">P3X HTML Final Notes </h1>
|
|
60
|
+
<p style="margin: 5px 0 0; font-size: 14px; color: #555;">Generated: ${new Date().toLocaleDateString()}</p>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
56
64
|
<div id="p3x-footer" data-height="10mm">
|
|
57
65
|
<div style="text-align: right; font-size: 12px; color: #777;">
|
|
58
66
|
Page \${page} of \${pages}
|
|
59
67
|
</div>
|
|
60
68
|
</div>
|
|
69
|
+
<div id="p3x-footer-last" data-height="10mm">
|
|
70
|
+
<div style="text-align: right; font-size: 12px; color: #777;">
|
|
71
|
+
Final \${page} of \${pages}
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
61
74
|
<div>
|
|
62
75
|
<h2 style="color: #222;">Invoice Content</h2>
|
|
63
76
|
<p style="font-size: 14px; color: #555;">This invoice showcases structured content on a single page for detailed clarity.</p>
|
|
@@ -106,7 +119,6 @@ const fs = require('fs');
|
|
|
106
119
|
</div>
|
|
107
120
|
<div class="ng-template-page-break"></div>
|
|
108
121
|
<div>
|
|
109
|
-
<h2 style="color: #222;">Final Notes</h2>
|
|
110
122
|
<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>
|
|
111
123
|
</div>
|
|
112
124
|
`,
|