n8n-nodes-htmlcsstopdf 2.1.2 → 3.0.0
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
|
@@ -8,155 +8,15 @@ An n8n community node for converting HTML content to PDF documents and capturing
|
|
|
8
8
|
|
|
9
9
|
- **HTML to PDF**: Convert custom HTML/CSS content to PDF documents
|
|
10
10
|
- **Website to PDF**: Capture full-page website screenshots as PDF files
|
|
11
|
-
- **Flexible Output**: Support for URL
|
|
11
|
+
- **Flexible Output**: Support for URL and File response formats
|
|
12
12
|
- **Customizable Viewport**: Configure viewport dimensions for optimal rendering
|
|
13
13
|
- **Full Page Capture**: Option to capture entire web pages or specific viewport areas
|
|
14
|
+
- **Configurable Timeout**: Adjust timeout settings for large PDF generation
|
|
14
15
|
|
|
15
16
|
## Installation
|
|
16
17
|
|
|
17
18
|
Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n community nodes documentation.
|
|
18
19
|
|
|
19
|
-
Install via n8n's Community Nodes feature:
|
|
20
|
-
1. Go to Settings > Community Nodes in your n8n instance
|
|
21
|
-
2. Install `n8n-nodes-htmlcsstopdf`
|
|
22
|
-
|
|
23
|
-
Or install manually:
|
|
24
|
-
```bash
|
|
25
|
-
npm install n8n-nodes-htmlcsstopdf
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Installation
|
|
29
|
-
|
|
30
|
-
<<<<<<< HEAD
|
|
31
|
-
- n8n version 0.187.0 or higher
|
|
32
|
-
- PDFMunk API credentials (sign up at [PDFMunk](https://pdfmunk.com))
|
|
33
|
-
|
|
34
|
-
## Credentials
|
|
35
|
-
|
|
36
|
-
This node requires PDFMunk API credentials:
|
|
37
|
-
|
|
38
|
-
1. Create an account at [PDFMunk](https://pdfmunk.com)
|
|
39
|
-
2. Generate your API key from the dashboard
|
|
40
|
-
3. In n8n, create new credentials of type "HTMLCSStoPDF API"
|
|
41
|
-
4. Enter your PDFMunk API key
|
|
42
|
-
|
|
43
|
-
## Operations
|
|
44
|
-
|
|
45
|
-
### HTML to PDF
|
|
46
|
-
Convert custom HTML and CSS content into PDF documents.
|
|
47
|
-
|
|
48
|
-
**Parameters:**
|
|
49
|
-
- **HTML Content**: The HTML content to convert
|
|
50
|
-
- **CSS Content**: Optional CSS styling for the HTML
|
|
51
|
-
- **Viewport Width**: Viewport width in pixels (default: 1080)
|
|
52
|
-
- **Viewport Height**: Viewport height in pixels (default: 720)
|
|
53
|
-
- **Response Format**: Choose between URL, PNG, or Base64 output
|
|
54
|
-
|
|
55
|
-
**Example Use Cases:**
|
|
56
|
-
- Generate invoices from HTML templates
|
|
57
|
-
- Create reports with custom styling
|
|
58
|
-
- Convert rich text content to PDF documents
|
|
59
|
-
|
|
60
|
-
### URL to PDF
|
|
61
|
-
Capture website screenshots and save them as PDF documents.
|
|
62
|
-
|
|
63
|
-
**Parameters:**
|
|
64
|
-
- **URL**: The website URL to capture
|
|
65
|
-
- **Full Page**: Capture the entire page (default: true)
|
|
66
|
-
- **Wait Time**: Milliseconds to wait before capturing (default: 10000)
|
|
67
|
-
- **Viewport Width**: Viewport width in pixels (default: 1080)
|
|
68
|
-
- **Viewport Height**: Viewport height in pixels (default: 720)
|
|
69
|
-
|
|
70
|
-
**Example Use Cases:**
|
|
71
|
-
- Archive web pages as PDFs
|
|
72
|
-
- Generate website screenshots for documentation
|
|
73
|
-
- Create visual reports of web content
|
|
74
|
-
|
|
75
|
-
## Example Workflows
|
|
76
|
-
|
|
77
|
-
### Generate Invoice PDF
|
|
78
|
-
```javascript
|
|
79
|
-
// Previous node provides customer data
|
|
80
|
-
{
|
|
81
|
-
"operation": "htmlToPdf",
|
|
82
|
-
"html_content": `
|
|
83
|
-
<html>
|
|
84
|
-
<body>
|
|
85
|
-
<h1>Invoice #{{$json.invoiceNumber}}</h1>
|
|
86
|
-
<p>Customer: {{$json.customerName}}</p>
|
|
87
|
-
<p>Amount: ${{$json.amount}}</p>
|
|
88
|
-
</body>
|
|
89
|
-
</html>
|
|
90
|
-
`,
|
|
91
|
-
"css_content": `
|
|
92
|
-
body { font-family: Arial, sans-serif; }
|
|
93
|
-
h1 { color: #333; }
|
|
94
|
-
`,
|
|
95
|
-
"response_format": "base64"
|
|
96
|
-
}
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
### Website Screenshot
|
|
100
|
-
```javascript
|
|
101
|
-
{
|
|
102
|
-
"operation": "urlToPdf",
|
|
103
|
-
"url": "https://example.com",
|
|
104
|
-
"full_page": true,
|
|
105
|
-
"wait_till": 5000,
|
|
106
|
-
"viewPortWidth": 1920,
|
|
107
|
-
"viewPortHeight": 1080
|
|
108
|
-
}
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
## Output
|
|
112
|
-
|
|
113
|
-
The node returns:
|
|
114
|
-
- **URL format**: Direct link to the generated PDF
|
|
115
|
-
- **PNG format**: PNG image data
|
|
116
|
-
- **Base64 format**: Base64 encoded PDF data
|
|
117
|
-
|
|
118
|
-
## Error Handling
|
|
119
|
-
|
|
120
|
-
The node includes comprehensive error handling:
|
|
121
|
-
- Invalid HTML/CSS content
|
|
122
|
-
- Network connectivity issues
|
|
123
|
-
- API rate limiting
|
|
124
|
-
- Invalid URLs or parameters
|
|
125
|
-
|
|
126
|
-
## Compatibility
|
|
127
|
-
|
|
128
|
-
- **n8n version**: 0.187.0+
|
|
129
|
-
- **Node.js**: 18.0.0+
|
|
130
|
-
- **Supported formats**: HTML, CSS, PDF, PNG, Base64
|
|
131
|
-
|
|
132
|
-
## Resources
|
|
133
|
-
|
|
134
|
-
- [n8n community nodes documentation](https://docs.n8n.io/integrations/community-nodes/)
|
|
135
|
-
- [PDFMunk API Documentation](https://pdfmunk.com/api-docs)
|
|
136
|
-
- [n8n workflow examples](https://n8n.io/workflows)
|
|
137
|
-
|
|
138
|
-
## Support
|
|
139
|
-
|
|
140
|
-
- Report issues on [GitHub](https://github.com/yourusername/n8n-nodes-htmlcsstopdf)
|
|
141
|
-
- Join the [n8n community](https://community.n8n.io/)
|
|
142
|
-
- Check [PDFMunk support](https://pdfmunk.com/support)
|
|
143
|
-
|
|
144
|
-
## Version History
|
|
145
|
-
|
|
146
|
-
- **1.0.0**: Initial release with HTML to PDF and URL to PDF operations
|
|
147
|
-
|
|
148
|
-
## Contributing
|
|
149
|
-
|
|
150
|
-
Contributions are welcome! Please read the contributing guidelines and submit pull requests for any improvements.
|
|
151
|
-
|
|
152
|
-
## License
|
|
153
|
-
|
|
154
|
-
[MIT](LICENSE.md)
|
|
155
|
-
|
|
156
|
-
---
|
|
157
|
-
|
|
158
|
-
Built with ❤️ for the n8n community
|
|
159
|
-
=======
|
|
160
20
|
### Community Nodes (Recommended)
|
|
161
21
|
|
|
162
22
|
1. Go to **Settings > Community Nodes** in your n8n instance
|
|
@@ -185,11 +45,11 @@ RUN npm install -g n8n-nodes-htmlcsstopdf
|
|
|
185
45
|
USER node
|
|
186
46
|
```
|
|
187
47
|
|
|
188
|
-
## Getting Your
|
|
48
|
+
## Getting Your PDFMunk API Key
|
|
189
49
|
|
|
190
|
-
1. **Sign Up**: Visit [
|
|
50
|
+
1. **Sign Up**: Visit [PDFMunk.com](https://pdfmunk.com) and create an account
|
|
191
51
|
2. **Verify Email**: Check your email and verify your account
|
|
192
|
-
3. **Access Dashboard**: Log in to your
|
|
52
|
+
3. **Access Dashboard**: Log in to your PDFMunk dashboard
|
|
193
53
|
4. **Generate API Key**:
|
|
194
54
|
- Navigate to the "API Keys" section
|
|
195
55
|
- Click "Generate New API Key"
|
|
@@ -207,22 +67,58 @@ USER node
|
|
|
207
67
|
1. In n8n, go to **Credentials**
|
|
208
68
|
2. Click **+ Add Credential**
|
|
209
69
|
3. Search for "HtmlCssToPdf API"
|
|
210
|
-
4. Enter your
|
|
70
|
+
4. Enter your PDFMunk API key
|
|
211
71
|
5. Test the connection
|
|
212
72
|
6. Save the credential
|
|
213
73
|
|
|
74
|
+
## Operations
|
|
75
|
+
|
|
76
|
+
### HTML to PDF
|
|
77
|
+
Convert custom HTML and CSS content into PDF documents.
|
|
78
|
+
|
|
79
|
+
**Parameters:**
|
|
80
|
+
- **HTML Content**: The HTML content to convert
|
|
81
|
+
- **CSS Content**: Optional CSS styling for the HTML
|
|
82
|
+
- **Viewport Width**: Viewport width in pixels (default: 1080)
|
|
83
|
+
- **Viewport Height**: Viewport height in pixels (default: 720)
|
|
84
|
+
- **Output Format**: Choose between URL or File output
|
|
85
|
+
- **Timeout**: Request timeout in seconds (default: 300 seconds = 5 minutes). Increase this for large PDFs.
|
|
86
|
+
|
|
87
|
+
**Example Use Cases:**
|
|
88
|
+
- Generate invoices from HTML templates
|
|
89
|
+
- Create reports with custom styling
|
|
90
|
+
- Convert rich text content to PDF documents
|
|
91
|
+
|
|
92
|
+
### URL to PDF
|
|
93
|
+
Capture website screenshots and save them as PDF documents.
|
|
94
|
+
|
|
95
|
+
**Parameters:**
|
|
96
|
+
- **URL**: The website URL to capture
|
|
97
|
+
- **Full Page**: Capture the entire page (default: true)
|
|
98
|
+
- **Wait Time**: Milliseconds to wait before capturing (default: 10000)
|
|
99
|
+
- **Viewport Width**: Viewport width in pixels (default: 1080)
|
|
100
|
+
- **Viewport Height**: Viewport height in pixels (default: 720)
|
|
101
|
+
- **Output Format**: Choose between URL or File output
|
|
102
|
+
- **Timeout**: Request timeout in seconds (default: 300 seconds = 5 minutes). Increase this for large PDFs.
|
|
103
|
+
|
|
104
|
+
**Example Use Cases:**
|
|
105
|
+
- Archive web pages as PDFs
|
|
106
|
+
- Generate website screenshots for documentation
|
|
107
|
+
- Create visual reports of web content
|
|
108
|
+
|
|
214
109
|
## Usage
|
|
215
110
|
|
|
216
111
|
### Basic HTML to PDF Conversion
|
|
217
112
|
|
|
218
113
|
```json
|
|
219
114
|
{
|
|
220
|
-
"
|
|
221
|
-
"
|
|
222
|
-
"
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
115
|
+
"operation": "htmlToPdf",
|
|
116
|
+
"html_content": "<h1>Hello World</h1><p>This is a test document.</p>",
|
|
117
|
+
"css_content": "h1 { color: blue; } p { font-size: 14px; }",
|
|
118
|
+
"viewPortWidth": 1080,
|
|
119
|
+
"viewPortHeight": 720,
|
|
120
|
+
"output_format": "file",
|
|
121
|
+
"timeout": 300
|
|
226
122
|
}
|
|
227
123
|
```
|
|
228
124
|
|
|
@@ -292,29 +188,6 @@ USER node
|
|
|
292
188
|
- **Price Lists**: Convert product catalogs to PDF format
|
|
293
189
|
- **Quotation PDFs**: Transform quotes into professional PDFs
|
|
294
190
|
|
|
295
|
-
## Node Options
|
|
296
|
-
|
|
297
|
-
| Option | Type | Description | Default |
|
|
298
|
-
|--------|------|-------------|---------|
|
|
299
|
-
| HTML Content | string | The HTML content to convert | Required |
|
|
300
|
-
| CSS Styles | string | Custom CSS for styling | Optional |
|
|
301
|
-
| Page Format | select | Paper size (A4, Letter, Legal, etc.) | A4 |
|
|
302
|
-
| Orientation | select | Portrait or Landscape | Portrait |
|
|
303
|
-
| Margins | object | Page margins in pixels | {top: 20, right: 20, bottom: 20, left: 20} |
|
|
304
|
-
| Header HTML | string | Header content for each page | Optional |
|
|
305
|
-
| Footer HTML | string | Footer content for each page | Optional |
|
|
306
|
-
| Scale | number | Zoom level (0.1 to 2.0) | 1 |
|
|
307
|
-
|
|
308
|
-
## Error Handling
|
|
309
|
-
|
|
310
|
-
The node provides detailed error messages for common issues:
|
|
311
|
-
|
|
312
|
-
- **Invalid API Key**: Check your PdfMunk credentials
|
|
313
|
-
- **HTML Parse Error**: Validate your HTML syntax
|
|
314
|
-
- **CSS Error**: Check your CSS for syntax errors
|
|
315
|
-
- **Rate Limit**: Upgrade your PdfMunk plan or wait for reset
|
|
316
|
-
- **Network Error**: Check your internet connection
|
|
317
|
-
|
|
318
191
|
## Workflow Examples
|
|
319
192
|
|
|
320
193
|
### Example 1: E-commerce Invoice
|
|
@@ -369,49 +242,88 @@ The node provides detailed error messages for common issues:
|
|
|
369
242
|
}
|
|
370
243
|
```
|
|
371
244
|
|
|
245
|
+
## Output
|
|
246
|
+
|
|
247
|
+
The node returns:
|
|
248
|
+
- **URL format**: Direct link to the generated PDF
|
|
249
|
+
- **File format**: Binary PDF file data that can be saved or sent via email
|
|
250
|
+
|
|
251
|
+
## Error Handling
|
|
252
|
+
|
|
253
|
+
The node provides detailed error messages for common issues:
|
|
254
|
+
|
|
255
|
+
- **Invalid API Key**: Check your PDFMunk credentials
|
|
256
|
+
- **HTML Parse Error**: Validate your HTML syntax
|
|
257
|
+
- **CSS Error**: Check your CSS for syntax errors
|
|
258
|
+
- **Rate Limit**: Upgrade your PDFMunk plan or wait for reset
|
|
259
|
+
- **Network Error**: Check your internet connection
|
|
260
|
+
- **Timeout Error**: Increase the timeout setting for large PDFs (default: 300 seconds)
|
|
261
|
+
|
|
372
262
|
## FAQ
|
|
373
263
|
|
|
374
|
-
**Q: Is there a free tier?**
|
|
375
|
-
A: Yes,
|
|
264
|
+
**Q: Is there a free tier?**
|
|
265
|
+
A: Yes, PDFMunk offers 100 free conversions per month.
|
|
376
266
|
|
|
377
|
-
**Q: What HTML features are supported?**
|
|
267
|
+
**Q: What HTML features are supported?**
|
|
378
268
|
A: Most modern HTML5 and CSS3 features are supported, including flexbox, grid, and media queries.
|
|
379
269
|
|
|
380
|
-
**Q: Can I use external images?**
|
|
270
|
+
**Q: Can I use external images?**
|
|
381
271
|
A: Yes, images accessible via URL will be included in the PDF.
|
|
382
272
|
|
|
383
|
-
**Q: What's the maximum file size?**
|
|
384
|
-
A: PDFs can be up to 10MB on most plans. Check
|
|
273
|
+
**Q: What's the maximum file size?**
|
|
274
|
+
A: PDFs can be up to 10MB on most plans. Check PDFMunk documentation for current limits.
|
|
275
|
+
|
|
276
|
+
**Q: How do I generate large PDFs (100+ pages)?**
|
|
277
|
+
A: Increase the timeout setting in the node configuration. For large PDFs, set timeout to 600-900 seconds (10-15 minutes).
|
|
278
|
+
|
|
279
|
+
**Q: What should I do if I get a gateway timeout error?**
|
|
280
|
+
A: Increase the timeout parameter in the node settings. The default is 300 seconds (5 minutes), but large PDFs may need 600-900 seconds.
|
|
281
|
+
|
|
282
|
+
## Compatibility
|
|
283
|
+
|
|
284
|
+
- **n8n version**: 0.187.0+
|
|
285
|
+
- **Node.js**: 18.0.0+
|
|
286
|
+
- **Supported formats**: HTML, CSS, PDF
|
|
287
|
+
|
|
288
|
+
## Resources
|
|
385
289
|
|
|
386
|
-
|
|
387
|
-
|
|
290
|
+
- [n8n community nodes documentation](https://docs.n8n.io/integrations/community-nodes/)
|
|
291
|
+
- [PDFMunk API Documentation](https://pdfmunk.com/api-docs)
|
|
292
|
+
- [n8n workflow examples](https://n8n.io/workflows)
|
|
388
293
|
|
|
389
294
|
## Support
|
|
390
295
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
296
|
+
For questions or support, please contact us at: **support@pdfmunk.com**
|
|
297
|
+
|
|
298
|
+
You can also join the [n8n community forum](https://community.n8n.io/) for general n8n-related discussions.
|
|
394
299
|
|
|
395
300
|
## Contributing
|
|
396
301
|
|
|
397
|
-
Contributions are welcome! Please read our contributing guidelines and submit pull requests.
|
|
302
|
+
Contributions are welcome! Please read our contributing guidelines and submit pull requests for any improvements.
|
|
398
303
|
|
|
399
304
|
## License
|
|
400
305
|
|
|
401
|
-
MIT License - see LICENSE file for details.
|
|
306
|
+
MIT License - see [LICENSE.md](LICENSE.md) file for details.
|
|
402
307
|
|
|
403
308
|
## Changelog
|
|
404
309
|
|
|
310
|
+
### v2.1.1
|
|
311
|
+
- Added configurable timeout parameter for large PDF generation
|
|
312
|
+
- Improved error handling for gateway timeouts
|
|
313
|
+
- Updated documentation with timeout troubleshooting
|
|
314
|
+
|
|
405
315
|
### v2.0.2
|
|
406
316
|
- Improved error handling
|
|
407
|
-
- Added support for custom headers/footers
|
|
408
317
|
- Performance optimizations
|
|
409
318
|
|
|
410
319
|
### v2.0.1
|
|
411
320
|
- Bug fixes and stability improvements
|
|
412
321
|
|
|
413
322
|
### v2.0.0
|
|
414
|
-
- Complete rewrite with new
|
|
323
|
+
- Complete rewrite with new PDFMunk API
|
|
415
324
|
- Enhanced CSS support
|
|
416
325
|
- Better error messages
|
|
417
|
-
|
|
326
|
+
|
|
327
|
+
---
|
|
328
|
+
|
|
329
|
+
Built with ❤️ for the n8n community
|