8
n8n 中文网amn8n.com

将OneDrive Word文档转换为PDF

中级

这是一个File Management领域的自动化工作流,包含 13 个节点。主要使用 If, Set, Wait, Gmail, Filter 等节点。 使用Foxit自动将OneDrive Word文档转换为PDF并通过Gmail发送

前置要求
  • Google 账号和 Gmail API 凭证
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "qrBRgBi0nd8VY7sc",
  "meta": {
    "instanceId": "8a623c3f1a4c9388f43b80af022dca52562aec4339b44f00a07491999dffc00f",
    "templateCredsSetupCompleted": true
  },
  "name": "将OneDrive Word文档转换为PDF",
  "tags": [
    {
      "id": "Swe6KzLGcdB7njAR",
      "name": "PDF",
      "createdAt": "2025-07-14T17:02:10.668Z",
      "updatedAt": "2025-07-14T17:02:10.668Z"
    },
    {
      "id": "oMYiaJ6wcHDq684x",
      "name": "Conversion",
      "createdAt": "2025-07-14T17:02:14.256Z",
      "updatedAt": "2025-07-14T17:02:14.256Z"
    },
    {
      "id": "FB1YRnU695c41dkP",
      "name": "Foxit",
      "createdAt": "2025-07-14T17:02:18.561Z",
      "updatedAt": "2025-07-14T17:02:18.561Z"
    }
  ],
  "nodes": [
    {
      "id": "d4319891-723a-4492-ad66-effc03dc642d",
      "name": "Microsoft OneDrive触发器",
      "type": "n8n-nodes-base.microsoftOneDriveTrigger",
      "position": [
        0,
        0
      ],
      "parameters": {
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "id",
          "value": "01IZFFBT44M7VRGRBPXJBJHXORCT5YINXH"
        },
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "watchFolder": true
      },
      "credentials": {
        "microsoftOneDriveOAuth2Api": {
          "id": "dCZgCwfVNRcpQL4r",
          "name": "Microsoft Drive account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "beec5178-3de1-44a0-9f53-6d40deae295e",
      "name": "获取文件",
      "type": "n8n-nodes-base.microsoftOneDrive",
      "position": [
        480,
        0
      ],
      "parameters": {
        "fileId": "={{ $items('Microsoft OneDrive Trigger')[0].json.id }}",
        "operation": "download"
      },
      "credentials": {
        "microsoftOneDriveOAuth2Api": {
          "id": "dCZgCwfVNRcpQL4r",
          "name": "Microsoft Drive account"
        }
      },
      "executeOnce": false,
      "typeVersion": 1
    },
    {
      "id": "39a5e363-80fd-49d3-98f7-6c868fa6189e",
      "name": "设置文件字段",
      "type": "n8n-nodes-base.set",
      "position": [
        700,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "5a4c6404-42bf-433b-894a-154bf47d1217",
              "name": "bits",
              "type": "string",
              "value": "={{ data }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "58633032-2696-4f47-8b78-e5550c108fe4",
      "name": "转换为PDF",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1160,
        0
      ],
      "parameters": {
        "url": "https://na1.fusion.foxit.com/pdf-services/api/documents/create/pdf-from-word",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"documentId\": \"{{ $json.documentId }}\"\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpCustomAuth"
      },
      "credentials": {
        "httpCustomAuth": {
          "id": "itvQ81oceu7Z42Sz",
          "name": "Custom Auth account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "0d452501-d57c-48b0-96e3-1e553580db98",
      "name": "筛选Word文档",
      "type": "n8n-nodes-base.filter",
      "position": [
        220,
        0
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "e8875bfc-7f4a-4d08-8b45-a216b95f742a",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{$json.mimeType }}",
              "rightValue": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "5ad3be23-cbda-4710-bb24-e522981e6b75",
      "name": "上传至Foxit",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        920,
        0
      ],
      "parameters": {
        "url": "https://na1.fusion.foxit.com/pdf-services/api/documents/upload",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "=file",
              "parameterType": "formBinaryData",
              "inputDataFieldName": "data"
            }
          ]
        },
        "genericAuthType": "httpCustomAuth"
      },
      "credentials": {
        "httpCustomAuth": {
          "id": "itvQ81oceu7Z42Sz",
          "name": "Custom Auth account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "e1874368-beb4-43ef-83d0-9e203fdee282",
      "name": "检查任务",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1380,
        0
      ],
      "parameters": {
        "url": "=https://na1.fusion.foxit.com/pdf-services/api/tasks/{{$json.taskId}}",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpCustomAuth"
      },
      "credentials": {
        "httpCustomAuth": {
          "id": "itvQ81oceu7Z42Sz",
          "name": "Custom Auth account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "d28c9c29-8c3a-4bae-890d-72998bc87f1f",
      "name": "等待",
      "type": "n8n-nodes-base.wait",
      "position": [
        1980,
        100
      ],
      "webhookId": "e4b89533-2e60-4eba-822d-21b882c32183",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "8e42d320-6c61-4669-9ed0-a957fa802e18",
      "name": "任务是否完成?",
      "type": "n8n-nodes-base.if",
      "position": [
        1600,
        0
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "fa958cdc-d7a8-49b9-b577-13429bd7bcf5",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "COMPLETED"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "62b6aee1-6dea-4511-97f8-0604377ef29c",
      "name": "下载",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2000,
        -80
      ],
      "parameters": {
        "url": "=https://na1.fusion.foxit.com/pdf-services/api/documents/{{ $json.resultDocumentId}}/download",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpCustomAuth"
      },
      "credentials": {
        "httpCustomAuth": {
          "id": "itvQ81oceu7Z42Sz",
          "name": "Custom Auth account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "a89ed3e9-0fb1-4fb4-a3f9-627399602783",
      "name": "邮件发送PDF",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2400,
        -60
      ],
      "webhookId": "61ce5be6-e955-4efa-b871-95172539d45d",
      "parameters": {
        "sendTo": "raymondcamden@gmail.com",
        "message": "Enjoy your shiny PDF.",
        "options": {
          "attachmentsUi": {
            "attachmentsBinary": [
              {}
            ]
          }
        },
        "subject": "New Document"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "A7SxJ0FWjVNKGOnA",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "7454b3fc-cce6-4ea7-a0c1-a3a17f86cbc4",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        860,
        -220
      ],
      "parameters": {
        "width": 1460,
        "height": 640,
        "content": "## Foxit PDF服务"
      },
      "typeVersion": 1
    },
    {
      "id": "6ca1406b-ee37-4df7-b1df-628cc9d55f40",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        20,
        -560
      ],
      "parameters": {
        "color": 5,
        "width": 700,
        "height": 360,
        "content": "## 要求"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "callerPolicy": "workflowsFromSameOwner",
    "executionOrder": "v1"
  },
  "versionId": "56bdb01a-d76c-45c9-b8e5-87e981af6258",
  "connections": {
    "Wait": {
      "main": [
        [
          {
            "node": "Is the job done?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download": {
      "main": [
        [
          {
            "node": "Email PDF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get File": {
      "main": [
        [
          {
            "node": "Set File Field",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Task": {
      "main": [
        [
          {
            "node": "Is the job done?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to PDF": {
      "main": [
        [
          {
            "node": "Check Task",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter to Word": {
      "main": [
        [
          {
            "node": "Get File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set File Field": {
      "main": [
        [
          {
            "node": "Upload to Foxit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload to Foxit": {
      "main": [
        [
          {
            "node": "Convert to PDF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is the job done?": {
      "main": [
        [
          {
            "node": "Download",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Microsoft OneDrive Trigger": {
      "main": [
        [
          {
            "node": "Filter to Word",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 文件管理

需要付费吗?

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

工作流信息
难度等级
中级
节点数量13
分类1
节点类型9
难度说明

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

作者
Raymond Camden

Raymond Camden

@raymondcamden

As an API Evangelist for Foxit, Raymond Camden specializes in the power of APIs, the web platform, and generative AI. A prolific author and seasoned presenter, he has been a prominent voice in the developer community for over two decades. You can explore his work and insights on his long-running blog at www.raymondcamden.com or reach him directly at raymondcamden@gmail.com.

外部链接
在 n8n.io 查看

分享此工作流