Gotenberg を使用して HTML から PDF へ
中級
これはAI分野の自動化ワークフローで、6個のノードを含みます。主にHttpRequest, ConvertToFile, ExecuteWorkflowTriggerなどのノードを使用、AI技術を活用したスマート自動化を実現。 Gotenbergを使ってHTMLからPDFを作成
前提条件
- •ターゲットAPIの認証情報が必要な場合あり
カテゴリー
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
"meta": {
"instanceId": "e409ea34548a2afe2dffba31130cd1cf2e98ebe2afaeed2a63caf2a0582d1da0"
},
"nodes": [
{
"id": "f0636fec-85ad-47e8-ab43-9a313664be80",
"name": "index.htmlの作成",
"type": "n8n-nodes-base.convertToFile",
"position": [
100,
20
],
"parameters": {
"options": {
"encoding": "utf8",
"fileName": "index.html"
},
"operation": "toText",
"sourceProperty": "html"
},
"typeVersion": 1.1
},
{
"id": "efcaebc5-e2cc-4af5-a6f2-c75b58496dec",
"name": "GotenbergによるPDF変換",
"type": "n8n-nodes-base.httpRequest",
"position": [
320,
20
],
"parameters": {
"url": "http://gotenberg:3000/forms/chromium/convert/html",
"method": "POST",
"options": {},
"sendBody": true,
"contentType": "multipart-form-data",
"sendHeaders": true,
"bodyParameters": {
"parameters": [
{
"name": "form file",
"parameterType": "formBinaryData",
"inputDataFieldName": "data"
},
{
"name": "scale",
"value": "1"
},
{
"name": "metadata",
"value": "={\"Author\":\"IA2S\",\"Copyright\":\"IA2S\",\"CreateDate\":\"{{ $now.format('yyyy-MM-dd') }}\",\"Creator\":\"IA2S\",\"Keywords\":[],\"ModDate\":\"{{ $now.format('yyyy-MM-dd') }}\",\"PDFVersion\":1.7,\"Producer\":\"IA2S\",\"Subject\":\"PDF\",\"Title\":\"IA2S PDF\"}"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "Gotenberg-Output-Filename",
"value": "={{ $('Create PDF from HTML').last().json.file_name }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "44f89be8-8516-4d8a-a1e4-959c020ca7ae",
"name": "HTMLからのPDF生成",
"type": "n8n-nodes-base.executeWorkflowTrigger",
"position": [
-120,
20
],
"parameters": {
"inputSource": "jsonExample",
"jsonExample": "{\n \"html\": \"<h1>Hello World</h1>\",\n \"file_name\": \"my-report-2024\"\n}"
},
"typeVersion": 1.1
},
{
"id": "710d67d4-db4a-4943-9ff7-49af8101443a",
"name": "付箋",
"type": "n8n-nodes-base.stickyNote",
"position": [
260,
-340
],
"parameters": {
"color": 6,
"width": 320,
"height": 540,
"content": "### 🚀 GOTENBERG API CALL\n\nThis node sends the HTML file to your Gotenberg service for conversion.\n\n**IMPORTANT:**\nThe default URL is `http://gotenberg:3000`. This works if n8n and Gotenberg are on the same Docker network. **If your Gotenberg is hosted elsewhere, you must update the URL here.**\n\n**Customization:**\nYou can edit the PDF metadata (Author, Title, etc.) in the `metadata` field under Body Parameters."
},
"typeVersion": 1
},
{
"id": "365e90ba-b4fa-42b1-9236-33b2f8fb1e76",
"name": "付箋1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-400,
-340
],
"parameters": {
"color": 7,
"width": 440,
"height": 540,
"content": "### ▶️ INPUT & CONFIGURATION\n\nThis workflow requires an input with two fields:\n\n1. `html`: A string containing the full HTML code to be converted.\n2. `file_name`: The desired name for the output file (without the `.pdf` extension).\n\n**Example Input:**\n```json\n{\n \"html\": \"<h1>Hello World</h1>\",\n \"file_name\": \"my-report-2024\"\n}"
},
"typeVersion": 1
},
{
"id": "c8b440bc-fb02-4b77-89c7-62c2bb88d28e",
"name": "付箋2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-880,
-340
],
"parameters": {
"color": 3,
"width": 440,
"height": 280,
"content": "### 🐳 PREREQUISITE: GOTENBERG SERVICE\n\nTo use this workflow, you need a running Gotenberg instance.\n\nThe easiest way is to add this to your `docker-compose.yml` and restart your stack:\n\n```yaml\n gotenberg:\n image: gotenberg/gotenberg:8\n restart: always"
},
"typeVersion": 1
}
],
"pinData": {
"Create PDF from HTML": [
{
"html": "<h1>Hello World</h1>",
"file_name": "my-report-2024"
}
]
},
"connections": {
"f0636fec-85ad-47e8-ab43-9a313664be80": {
"main": [
[
{
"node": "efcaebc5-e2cc-4af5-a6f2-c75b58496dec",
"type": "main",
"index": 0
}
]
]
},
"44f89be8-8516-4d8a-a1e4-959c020ca7ae": {
"main": [
[
{
"node": "f0636fec-85ad-47e8-ab43-9a313664be80",
"type": "main",
"index": 0
}
]
]
}
}
}よくある質問
このワークフローの使い方は?
上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。
このワークフローはどんな場面に適していますか?
中級 - 人工知能
有料ですか?
このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。
関連ワークフロー
自動n8nアップデータ(Docker)
自動n8nアップデーター(Docker)
If
Set
Ssh
+
If
Set
Ssh
26 ノードLucas Peyrin
人工知能
バイナリMIMEタイプ-拡張子変更
バイナリMIMEタイプ/拡張子の変更
Set
Code
Extract From File
+
Set
Code
Extract From File
6 ノードLucas Peyrin
人工知能
インタラクティブなハンズオンチュートリアルでAPIの基礎を学ぶ
対話のなハンズオントレーニングでAPIの基礎を学ぶ
If
Set
Wait
+
If
Set
Wait
28 ノードLucas Peyrin
人工知能
Gemini RAGパイプラインを使ったドキュメント専門家チャットボット
Gemini RAGパイプラインを使用したドキュメント専家チャットボット
Set
Html
Filter
+
Set
Html
Filter
48 ノードLucas Peyrin
内部Wiki
正規表現と AI を使って隠れたウェブサイトの API エンドポイントを発見
正規表現とAIを使って隠れたウェブサイトのAPIエンドポイントを発見する
If
Set
Html
+
If
Set
Html
58 ノードYulia
エンジニアリング
ComfyUI を使用して AI メディアの生成:画像、動画、3D、オーディオ橋渡し
ComfyUI を使って AI メディアを生成する:画像、動画、3D、オーディオ連携
If
Set
Code
+
If
Set
Code
51 ノードNielo
デザイン
ワークフロー情報
難易度
中級
ノード数6
カテゴリー1
ノードタイプ4
作成者
Lucas Peyrin
@lucaspeyrinInnovative builder with a passion for crafting automation solutions that solve real-world challenges. From streamlining workflows to driving efficiency, my work empowers teams and individuals to achieve more with less effort. Experienced in developing scalable tools and strategies that deliver results with n8n, supabase and cline.
外部リンク
n8n.ioで表示 →
このワークフローを共有