Created
March 21, 2024 16:51
-
-
Save diramazioni/7c06486657f684dfa3e5cf532024802d to your computer and use it in GitHub Desktop.
[n8n] pdf creation via gotenberg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"meta": { | |
"templateCredsSetupCompleted": true, | |
"instanceId": "dde92b23ec8ad53d33ff02dc2a916e6b809358c3f4fb484668669e400dca75cb" | |
}, | |
"nodes": [ | |
{ | |
"parameters": { | |
"operation": "convertToHtmlTable", | |
"options": {} | |
}, | |
"id": "eea34b3f-5459-4651-a19a-7428e0f7f16a", | |
"name": "HTML1", | |
"type": "n8n-nodes-base.html", | |
"typeVersion": 1.2, | |
"position": [ | |
620, | |
1180 | |
] | |
}, | |
{ | |
"parameters": { | |
"html": "<!DOCTYPE html>\n\n<html>\n<head>\n <meta charset=\"UTF-8\" />\n <title>Questionari inviati</title>\n</head>\n<body>\n <h1>Questionari inviati</h1>\n <div class=\"container\">\n{{ $json.table }}\n </div>\n</body>\n</html>\n\n<style>\n.container {\n background-color: #ffffff;\n text-align: center;\n padding: 16px;\n border-radius: 8px;\n}\n\nh1 {\n color: #ff6d5a;\n font-size: 24px;\n font-weight: bold;\n padding: 8px;\n margin: auto\n}\n\nh2 {\n color: #909399;\n font-size: 18px;\n font-weight: bold;\n padding: 8px;\n}\n</style>\n\n<script>\nconsole.log(\"Hello World!\");\n</script>" | |
}, | |
"id": "b99ba194-7b8e-4698-8b67-1f4966188100", | |
"name": "HTML2", | |
"type": "n8n-nodes-base.html", | |
"typeVersion": 1.2, | |
"position": [ | |
800, | |
1180 | |
] | |
}, | |
{ | |
"parameters": { | |
"operation": "toBinary", | |
"sourceProperty": "html", | |
"options": { | |
"dataIsBase64": true, | |
"fileName": "index.html", | |
"mimeType": "text/html" | |
} | |
}, | |
"id": "b243b356-be08-4d15-b865-b560224be665", | |
"name": "Convert to HTML", | |
"type": "n8n-nodes-base.convertToFile", | |
"typeVersion": 1, | |
"position": [ | |
1020, | |
1180 | |
] | |
}, | |
{ | |
"parameters": { | |
"path": "questionario", | |
"formTitle": "test form", | |
"formFields": { | |
"values": [ | |
{ | |
"fieldLabel": "name" | |
}, | |
{ | |
"fieldLabel": "email" | |
} | |
] | |
}, | |
"responseMode": "responseNode" | |
}, | |
"id": "16b3c3e8-b2d7-46f2-95d5-cea63350c082", | |
"name": "test-form", | |
"type": "n8n-nodes-base.formTrigger", | |
"typeVersion": 2, | |
"position": [ | |
420, | |
1180 | |
], | |
"webhookId": "deff863a-4186-4b2c-80c6-f47a6e55dfae" | |
}, | |
{ | |
"parameters": { | |
"method": "POST", | |
"url": "https://demo.gotenberg.dev/forms/chromium/convert/html", | |
"sendHeaders": true, | |
"headerParameters": { | |
"parameters": [ | |
{ | |
"name": "Gotenberg-Output-Filename", | |
"value": "report" | |
} | |
] | |
}, | |
"sendBody": true, | |
"contentType": "multipart-form-data", | |
"bodyParameters": { | |
"parameters": [ | |
{ | |
"parameterType": "formBinaryData", | |
"name": "files", | |
"inputDataFieldName": "data" | |
} | |
] | |
}, | |
"options": {} | |
}, | |
"id": "ca94eceb-b67a-429e-ad45-378f76046776", | |
"name": "demo api for PDF", | |
"type": "n8n-nodes-base.httpRequest", | |
"typeVersion": 4.1, | |
"position": [ | |
1180, | |
1360 | |
] | |
}, | |
{ | |
"parameters": { | |
"respondWith": "binary", | |
"options": { | |
"responseHeaders": { | |
"entries": [ | |
{ | |
"name": "Content-Type", | |
"value": "application/pdf" | |
} | |
] | |
} | |
} | |
}, | |
"id": "d7d9ad74-ccdf-4e5e-97b5-2efd77e0905c", | |
"name": "Respond to Webhook", | |
"type": "n8n-nodes-base.respondToWebhook", | |
"typeVersion": 1, | |
"position": [ | |
1460, | |
1360 | |
] | |
} | |
], | |
"connections": { | |
"HTML1": { | |
"main": [ | |
[ | |
{ | |
"node": "HTML2", | |
"type": "main", | |
"index": 0 | |
} | |
] | |
] | |
}, | |
"HTML2": { | |
"main": [ | |
[ | |
{ | |
"node": "Convert to HTML", | |
"type": "main", | |
"index": 0 | |
} | |
] | |
] | |
}, | |
"Convert to HTML": { | |
"main": [ | |
[ | |
{ | |
"node": "demo api for PDF", | |
"type": "main", | |
"index": 0 | |
} | |
] | |
] | |
}, | |
"test-form": { | |
"main": [ | |
[ | |
{ | |
"node": "HTML1", | |
"type": "main", | |
"index": 0 | |
} | |
] | |
] | |
}, | |
"demo api for PDF": { | |
"main": [ | |
[ | |
{ | |
"node": "Respond to Webhook", | |
"type": "main", | |
"index": 0 | |
} | |
] | |
] | |
} | |
}, | |
"pinData": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment