8
n8n 中文网amn8n.com

使用Datalab.to API将PDF、DOC和图像转换为Markdown

中级

这是一个Document Extraction, Multimodal AI领域的自动化工作流,包含 11 个节点。主要使用 Set, Wait, Switch, FormTrigger, HttpRequest 等节点。 使用Datalab.to API将PDF、DOC和图像转换为Markdown

前置要求
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "b3c467df4053d13fe31cc98f3c66fa1d16300ba750506bfd019a0913cec71ea3"
  },
  "nodes": [
    {
      "id": "c302f8e5-6bed-4b64-8d52-33eaa5fce86a",
      "name": "表单提交时",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -336,
        48
      ],
      "webhookId": "a857ad3f-4b4d-4574-b503-809a95b1fbbf",
      "parameters": {
        "options": {},
        "formTitle": "upload file",
        "formFields": {
          "values": [
            {
              "fieldType": "file",
              "fieldLabel": "file",
              "multipleFiles": false,
              "requiredField": true
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "3cc12307-f5da-476a-811a-79920f20abf7",
      "name": "获取 Markdown",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        336,
        48
      ],
      "parameters": {
        "url": "={{ $json.request_check_url }}",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "7Wx4MGEDgCG0D7fT",
          "name": "datalab.io"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "ec9e9703-fb38-4ba5-97f6-a73bee7c47f7",
      "name": "发送到 Datalab API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -112,
        48
      ],
      "parameters": {
        "url": "https://www.datalab.to/api/v1/marker",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "max_pages",
              "value": "4"
            },
            {
              "name": "use_llm",
              "value": "true"
            },
            {
              "name": "output_format",
              "value": "markdown"
            },
            {
              "name": "file",
              "parameterType": "formBinaryData",
              "inputDataFieldName": "file"
            }
          ]
        },
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "7Wx4MGEDgCG0D7fT",
          "name": "datalab.io"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "542793bf-05c1-4c6c-b0e0-b087669f966c",
      "name": "设置字段",
      "type": "n8n-nodes-base.set",
      "position": [
        560,
        48
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "20280dbd-8188-4f5e-8e4e-74621d65d40a",
              "name": "markdown",
              "type": "string",
              "value": "={{ $json.markdown }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "cb900de1-e4b1-488f-8a12-9946bb8466f6",
      "name": "等待",
      "type": "n8n-nodes-base.wait",
      "position": [
        112,
        48
      ],
      "webhookId": "7b49cf9b-9859-4361-a8b8-2407d114d418",
      "parameters": {
        "amount": 10
      },
      "typeVersion": 1.1
    },
    {
      "id": "9fcdcaab-2041-4411-8ec1-10edfe29f1d6",
      "name": "便签13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1424,
        -32
      ],
      "parameters": {
        "width": 972,
        "height": 564,
        "content": "![](https://res.cloudinary.com/dd6vlwblr/image/upload/v1756196495/Convert_PDF_DOC_IMAGES_to_1_sfdzu1.png)"
      },
      "typeVersion": 1
    },
    {
      "id": "32550fd8-2570-4e42-b249-8d53288da00a",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -416,
        -32
      ],
      "parameters": {
        "width": 1200,
        "height": 272,
        "content": "## 使用 Datalab.to 将文件转换为适用于 LLM 的 Markdown 格式"
      },
      "typeVersion": 1
    },
    {
      "id": "f968189c-83c4-436c-91c6-dc0313ee4256",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -416,
        272
      ],
      "parameters": {
        "width": 1200,
        "height": 256,
        "content": "## 指南"
      },
      "typeVersion": 1
    },
    {
      "id": "883e4090-cb4f-4de6-bfc4-4c5c7ce85728",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        816,
        -32
      ],
      "parameters": {
        "color": 6,
        "width": 400,
        "height": 416,
        "content": "## 轮询确认节点"
      },
      "typeVersion": 1
    },
    {
      "id": "4f0c8ae8-e92e-419f-a609-d426db8321d8",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "disabled": true,
      "position": [
        832,
        192
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "success",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "cbac06bd-0ee6-40ac-bad9-bdb0929ca0ad",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.status }}",
                    "rightValue": "complete"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "failed",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "bc2570f6-c9ec-4c4f-9a04-863be5fb1ced",
                    "operator": {
                      "type": "string",
                      "operation": "notEquals"
                    },
                    "leftValue": "={{ $json.status }}",
                    "rightValue": "complete"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "33ec2be6-e49a-4973-b105-5db71fc2cf40",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        816,
        400
      ],
      "parameters": {
        "color": 4,
        "width": 400,
        "height": 128,
        "content": "## 想与我合作吗?"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Wait": {
      "main": [
        [
          {
            "node": "Get Markdown",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Markdown": {
      "main": [
        [
          {
            "node": "Set Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Send to Datalab API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send to Datalab API": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

中级 - 文档提取, 多模态 AI

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
中级
节点数量11
分类2
节点类型6
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
Joseph

Joseph

@mjomba

Automation expert specializing in building smart, scalable workflows using tools like n8n, Make, and Airtable. I help businesses save time, reduce manual work, and grow faster with tailored automation solutions. Feel free to reach out at joseph@uppfy.com to discuss your project. I am also on x.com/juppfy

外部链接
在 n8n.io 查看

分享此工作流