p3x-html-pdf 2025.4.116 → 2025.4.118

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 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.116
9
+ # 📃 Generates PDF from HTML with custom headers and footers with wkhtmltopdf v2025.4.118
10
10
 
11
11
 
12
12
 
@@ -35,13 +35,15 @@ v22.13.0
35
35
  [//]: #@corifeus-header:end
36
36
 
37
37
 
38
- `p3x-html-pdf` is a Node.js package that generates PDFs from HTML with custom headers and footers using `wkhtmltopdf`. It is a robust tool for creating professional-grade PDFs with features like:
38
+ **p3x-html-pdf** is a Node.js package that generates PDFs from HTML with custom headers and footers using `wkhtmltopdf`. It is a robust tool for creating professional-grade PDFs with features like:
39
39
 
40
40
  - 📜 **Dynamic Headers and Footers**: Add placeholders for page numbers, dates, and more.
41
41
  - 🛠️ **Customizable Layouts**: Configure margins, orientation, and paper size.
42
42
  - ⚡ **Async/Await Support**: Modern JavaScript compatibility for efficient workflows.
43
43
  - 🔄 **Dynamic Content**: Render data-driven tables and content dynamically.
44
44
 
45
+ ---
46
+
45
47
  ## 🚀 Installation
46
48
 
47
49
  Install via Yarn:
@@ -50,18 +52,28 @@ Install via Yarn:
50
52
  yarn add p3x-html-pdf
51
53
  ```
52
54
 
55
+ Or install via npm:
56
+
57
+ ```bash
58
+ npm install p3x-html-pdf
59
+ ```
60
+
53
61
  Import in your project:
54
62
 
55
63
  ```javascript
56
64
  const { generate } = require('p3x-html-pdf');
57
65
  ```
58
66
 
67
+ ---
68
+
59
69
  ## 🛠️ Features
60
70
 
61
- - 📜 **Custom Headers and Footers**
62
- - 📏 **Flexible Page Settings**
63
- - ⚡ **Async/Await Support**
64
- - 📊 **Dynamic Tables and Content**
71
+ - 📜 **Custom Headers and Footers**: Create professional headers and footers with dynamic placeholders.
72
+ - 📏 **Flexible Page Settings**: Set paper size, orientation, margins, and more.
73
+ - ⚡ **Async/Await Support**: Fully compatible with modern JavaScript workflows.
74
+ - 📊 **Dynamic Tables and Content**: Generate tables and other dynamic HTML content easily.
75
+
76
+ ---
65
77
 
66
78
  ## 📖 Usage Example
67
79
 
@@ -116,12 +128,16 @@ const path = require('path');
116
128
  try {
117
129
  await generate(options);
118
130
  console.log('✅ PDF generated successfully!');
131
+ // or options.save = false
132
+ const buffer = await generate(options);
119
133
  } catch (err) {
120
134
  console.error('❌ Error generating PDF:', err);
121
135
  }
122
136
  })();
123
137
  ```
124
138
 
139
+ ---
140
+
125
141
  ## 🔧 Configuration
126
142
 
127
143
  ### Options
@@ -131,11 +147,19 @@ const path = require('path');
131
147
  - `template.format`: Page size, e.g., `A4`, `Letter`.
132
148
  - `template.orientation`: Page orientation (`portrait` or `landscape`).
133
149
  - `template.marginLeft`, `template.marginRight`: Margins in mm.
150
+ - `template.copies`: Copies to generate.
151
+ - `template.fixedWidth` and `template.fixedHeight`: If above zero, generates in millimeters.
134
152
  - `html`: HTML content with placeholders.
135
153
  - **title**: PDF document title.
136
154
  - **saveFile**: Path for saving the PDF.
137
155
 
138
- ### Placeholders
156
+ For more options, check the official [wkhtmltopdf usage guide](https://wkhtmltopdf.org/usage/wkhtmltopdf.txt).
157
+
158
+ ---
159
+
160
+ ## 🌟 Placeholders
161
+
162
+ You can use placeholders in your HTML for dynamic data:
139
163
 
140
164
  - `${page}`: Current page.
141
165
  - `${pages}`: Total pages.
@@ -143,29 +167,50 @@ const path = require('path');
143
167
  - `${isodate}`: ISO date format.
144
168
  - `${time}`: Current time.
145
169
 
170
+ Example:
171
+
172
+ ```html
173
+ <div id="p3x-footer" data-height="15mm">
174
+ <p>Page ${page} of ${pages} - Generated on ${date}</p>
175
+ </div>
176
+ ```
177
+
178
+ ---
179
+
146
180
  ## 📊 Advanced Features
147
181
 
148
182
  - **Debugging**: Use `debug: true` to enable detailed logs.
149
- - **Header/Footer Templates**: Define rich HTML templates for headers/footers.
183
+ - **Header/Footer Templates**: Create rich HTML templates for headers/footers.
184
+ - **Dynamic Content**: Inject dynamic tables, invoices, or other content into the PDF.
150
185
 
151
- ## 🤝 Contributing
186
+ ---
187
+
188
+ ## 🌍 Architecture
152
189
 
153
- Contributions are welcome! Feel free to submit issues or pull requests on [GitHub](https://github.com/patrikx3/html-pdf).
190
+ `p3x-html-pdf` works seamlessly on Linux and Windows.
154
191
 
155
- ## 📜 License
192
+ ### ARM64 Support
156
193
 
157
- This project is licensed under the [MIT License](https://github.com/patrikx3/html-pdf/blob/master/LICENSE).
194
+ If `os.arch() === 'arm64'`, the package automatically sets the `wkhtmltopdf` path to `/usr/local/bin/wkhtmltopdf-arm64`.
195
+ Download the binary manually and place it there:
196
+ [wkhtmltopdf-arm64 binary](https://github.com/houseoftech/wkhtmltopdf-arm64/raw/refs/heads/master/bin/wkhtmltopdf-arm64).
158
197
 
159
198
  ---
160
199
 
161
- For detailed documentation, visit the [npm page](https://www.npmjs.com/package/p3x-html-pdf).
200
+ ## 🖼️ Example Output
201
+
202
+ Check out an example output PDF:
203
+ [Example PDF](https://cdn.corifeus.com/git/html-pdf/test-output.pdf).
162
204
 
163
205
  ---
164
206
 
165
- ARM64 Support: If os.arch() === 'arm64', it automatically sets the wkhtmltopdf path to /usr/local/bin/wkhtmltopdf-arm64.
166
- You can download and place it at:
167
- https://github.com/houseoftech/wkhtmltopdf-arm64/raw/refs/heads/master/bin/wkhtmltopdf-arm64
207
+ ## License
208
+
209
+ This project is licensed under the MIT License.
210
+
211
+ ---
168
212
 
213
+ **Happy PDF Generating!** 🎉
169
214
 
170
215
  [//]: #@corifeus-footer
171
216
 
@@ -217,7 +262,7 @@ All my domains, including [patrikx3.com](https://patrikx3.com), [corifeus.hu](ht
217
262
  ---
218
263
 
219
264
 
220
- [**P3X-HTML-PDF**](https://corifeus.com/html-pdf) Build v2025.4.116
265
+ [**P3X-HTML-PDF**](https://corifeus.com/html-pdf) Build v2025.4.118
221
266
 
222
267
  [![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)
223
268
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "p3x-html-pdf",
3
- "version": "2025.4.116",
3
+ "version": "2025.4.118",
4
4
  "corifeus": {
5
5
  "prefix": "p3x-",
6
6
  "publish": true,
package/test-output.pdf CHANGED
Binary file
package/work/README.md DELETED
@@ -1,34 +0,0 @@
1
- [//]: #@corifeus-header
2
- [AIN](https://img.shields.io/npm/vp/p3x-html-pdf.svg)](https://www.npmjs.com/package/p3x-html-pdf)
3
- [AIN](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://paypal.me/patrikh3)
4
- [AIN]{(https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact)
5
- [AIN](https://img.shields.k
6
- >.badge/Facebook-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software)
7
- [AIN]{(https://img.shields.io/uptimerobot/ratio/m780749701-41bcade28c1ea8154eda7cca.svg?ext=")](https://stats.uptimerobot.com/9ggnzcWrw)
8
-
9
- Heading 13:
10
-
11
-
12
- <!-- # @corifeus-header:end -->
13
-
14
- [![NPM Version](https://img.shields.io/npm/v/p3x-html-pdf)](https://www.npmjs.com/package/p3x-html-pdf)
15
- [![License](https://img.shields.io/npm/l/p3x-html-pdf)](https://github.com/patrikx3/html-pdf/blob/master/LICENSE)
16
- [![Downloads](https://img.shields.io/npm/dw/p3x-html-pdf)](https://www.npmjs.com/package/p3x-html-pdf)
17
-
18
- ## “’ Overview
19
-
20
- **p3x-html-pdf** is a Node.js package that generates PDFs from HTML with custom headers and footers using **wkhtmltopdf**. It is a robust tool for creating professional-grade PDFs with features like:
21
-
22
- - **\� Snxr4 Dynamic"** Add placeholders for page numbers, dates, and more. -
23
- * ** ☍ Customizable Layouts**: Configure margins, formatting, orientation, and paper size.-
24
- * ** ❂ Async/Await Support**: Modern JavaScript compatibility for efficient workflows. --
25
- * ** ➠ Dynamic Content**: Render data-driven tables and content dynamically.
26
-
27
-
28
-
29
- ## “’ Installation
30
-
31
- Install via yarn:
32
-
33
-
34
- ``bash