{
  "id": "xCvhjjsaL9hxq1Vd",
  "name": "PDF share version",
  "tags": [
    {
      "id": "zR96hB2gFDOCwZ9a",
      "name": "share version",
      "createdAt": "2025-03-17T07:10:30.469Z",
      "updatedAt": "2025-03-17T07:10:30.469Z"
    }
  ],
  "nodes": [
    {
      "id": "3ea7b386-7abc-4492-85bb-63cd0e7e6f30",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2020,
        200
      ],
      "parameters": {
        "text": "=analyse all incoming image, and get the following item:\nvendor, item desciption, amount, date, paid date, bank reference number.\n\nif there is no a clear item description in the invoice, analyze the job duty of the vendor company and then return a short and clear item description.\n\nand the output as a schema format for each item.\n\nbank reference and paid date will normally be shown inside a red box or a red stamp.",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.7
    },
    {
      "id": "687ce062-9395-42ed-a1f2-6f94d6633d5a",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        1980,
        440
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.0-flash-exp"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "4936ad23-c94f-4703-82fd-96eb39c2b0f3",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        840,
        260
      ],
      "parameters": {
        "mode": "combine",
        "options": {
          "includeUnpaired": true
        },
        "combineBy": "combineByPosition",
        "numberInputs": 3
      },
      "typeVersion": 3
    },
    {
      "id": "7cd507a6-35c0-4ffb-bd9c-641aad7ebacc",
      "name": "Compression",
      "type": "n8n-nodes-base.compression",
      "position": [
        1660,
        40
      ],
      "parameters": {
        "outputPrefix": "data"
      },
      "typeVersion": 1.1
    },
    {
      "id": "dcb9f042-3afb-4341-a20d-8d5345b39460",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        1660,
        260
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "1ace5bbe-98c0-47a3-af00-70bd2efd7452",
                    "operator": {
                      "type": "number",
                      "operation": "gt"
                    },
                    "leftValue": "={{ $json.output_filenumber }}",
                    "rightValue": 1
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "96358ee3-ba28-4ad3-abf2-e12941563f97",
                    "operator": {
                      "type": "number",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.output_filenumber }}",
                    "rightValue": 1
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "376da694-9bc7-41ca-9874-8eaf4e7e1bd0",
      "name": "get server get task",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        680,
        60
      ],
      "parameters": {
        "url": "https://api.ilovepdf.com/v1/start/pdfjpg",
        "options": {},
        "sendBody": true,
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "public_key",
              "value": "project_public_1a15ac376a1025409d30893eb57f42bb_fpe-Z7da6e321d3080d988bc1916b869e3d36"
            },
            {
              "name": "tool",
              "value": "pdfjpg"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer  {{ $json.token }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "da05d062-0aca-4d38-b71f-eaac2c27f1ad",
      "name": "upload pdf",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1060,
        260
      ],
      "parameters": {
        "url": "=https://{{ $json.server }}/v1/upload",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "task",
              "value": "={{ $json.task }}"
            },
            {
              "name": "file",
              "parameterType": "formBinaryData",
              "inputDataFieldName": "data"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{ $json.token }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "440c4128-67c1-4c60-b006-fd9d74ec22d0",
      "name": "convert to jpg",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1260,
        260
      ],
      "parameters": {
        "url": "=https://{{ $('Merge').item.json.server }}/v1/process",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n    \"task\": \"{{ $('Merge').item.json.task }}\",\n    \"tool\": \"pdfjpg\",\n    \"files\": [\n        {\n            \"server_filename\": \"{{ $json.server_filename }}\",\n            \"filename\": \"file.pdf\"\n        }\n    ]\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{ $('Merge').item.json.token }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "e329cd44-d337-4bc4-8742-c9efa82fa3f9",
      "name": "download file",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1460,
        260
      ],
      "parameters": {
        "url": "=https://{{ $('Merge').item.json.server }}/v1/download/{{ $('Merge').item.json.task }}",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{ $('Merge').item.json.token }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "2fce8ce5-fee6-4377-adaa-54ed405567cb",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        2260,
        440
      ],
      "parameters": {
        "jsonSchemaExample": "{\n\t\"Vendor\": {\n\t\t\"value\": \"California\",\n\t\t\"description\": \"The services provides who receive the payment\"\n\t},\n\t\"amount\": {\n\t\t\"value\": \"HKD2000\",\n\t\t\"description\": \"The amount of money being transferred with the used currency\"\n\t},\n\t\"invoice_date\": {\n\t\t\"value\": \"yyyy-mm-dd\",\n\t\t\"description\": \"The date of the invoice\"\n\t},\n\t\"description\": {\n\t\t\"value\": \"annual fee\",\n\t\t\"description\": \"A brief description of the payment\"\n\t},\n    \"paid_date\": {\n\t\t\"value\": \"yyyy-mm-dd\",\n\t\t\"description\": \"The date of the invoic esettled\"\n\t},\n    \"bank_reference\": {\n\t\t\"value\": \"14032025-08\",\n\t\t\"description\": \"the bank reference number of the payment\"\n\t}\n}\n"
      },
      "typeVersion": 1.2
    },
    {
      "id": "5c1b7997-35db-4dd3-bb35-d3d8c2311a15",
      "name": "Airtable",
      "type": "n8n-nodes-base.airtable",
      "position": [
        2500,
        220
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "appF41Ezyux2EZoE7",
          "cachedResultUrl": "https://airtable.com/appF41Ezyux2EZoE7",
          "cachedResultName": "Personal Project Organizer"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tbljQ8zBCsSMy3uC7",
          "cachedResultUrl": "https://airtable.com/appF41Ezyux2EZoE7/tbljQ8zBCsSMy3uC7",
          "cachedResultName": "Invocie log"
        },
        "columns": {
          "value": {
            "date": "={{ $json.output.date.value }}",
            "Vendor": "={{ $json.output.Vendor.value }}",
            "amount": "={{ $json.output.amount.value }}",
            "description": "={{ $json.output.description.value }}"
          },
          "schema": [
            {
              "id": "Vendor",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Vendor",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "amount",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "amount",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "date",
              "type": "dateTime",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "description",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "create"
      },
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "eeaec474-020b-45f8-a412-2e47017617bd",
      "name": "When clicking \u2018Test workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        60,
        100
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "1defcb41-ddf5-47ce-817c-77c145628565",
      "name": "move file to done",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        2840,
        220
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Upload your file to google drive').item.json.id }}"
        },
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive",
          "cachedResultUrl": "https://drive.google.com/drive/my-drive",
          "cachedResultName": "My Drive"
        },
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "1SUIXA1ga3QvO14GI5xOa3YBTViDB8txh",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1SUIXA1ga3QvO14GI5xOa3YBTViDB8txh",
          "cachedResultName": "done"
        },
        "operation": "move"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "74a73b6e-f21b-4f61-a5dd-38a95ea25f9a",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        -20
      ],
      "parameters": {
        "width": 260,
        "height": 100,
        "content": "Upload file to the file google drive\nGet your Iloveapi here:\nhttps://www.iloveapi.com/"
      },
      "typeVersion": 1
    },
    {
      "id": "460141cc-33ec-4784-ba0e-1f8d20c46de8",
      "name": "Download file",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        660,
        420
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "options": {},
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "21e33675-02d0-423b-bef7-609634e3bf4b",
      "name": "Upload your file to google drive",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        80,
        360
      ],
      "parameters": {
        "event": "fileCreated",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "mode": "list",
          "value": "1Pn9W5H9roc3w5FpzDmm5eXCSnwC4Lk9c",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1Pn9W5H9roc3w5FpzDmm5eXCSnwC4Lk9c",
          "cachedResultName": "work invoice"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "8a943a2f-e785-4255-884d-9f4e07c37601",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        380,
        140
      ],
      "parameters": {
        "color": 4,
        "width": 150,
        "height": 80,
        "content": "Add the public key"
      },
      "typeVersion": 1
    },
    {
      "id": "663638af-7206-4f70-9ec6-83b08e84de36",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2420,
        120
      ],
      "parameters": {
        "width": 260,
        "height": 80,
        "content": "Change it to your airtable.\nYou can also change it to google sheet if you want"
      },
      "typeVersion": 1
    },
    {
      "id": "a9dde745-7c5f-46e7-bd26-f50b4024062d",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2020,
        80
      ],
      "parameters": {
        "color": 6,
        "width": 260,
        "height": 100,
        "content": "You can change the prompt to get the information you want"
      },
      "typeVersion": 1
    },
    {
      "id": "23c98648-e425-494b-96e6-604850e7af57",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2180,
        600
      ],
      "parameters": {
        "height": 80,
        "content": "You can change the json  to what you need based on the example."
      },
      "typeVersion": 1
    },
    {
      "id": "d81aa256-d494-40ed-9ddc-81837a6a72f6",
      "name": "Get token",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        400,
        240
      ],
      "parameters": {
        "url": "https://api.ilovepdf.com/v1/auth",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "public_key"
            }
          ]
        }
      },
      "typeVersion": 4.2
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "61649f7d-9a33-477f-b3a2-adcf7340328a",
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "upload pdf",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Compression",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Airtable",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Airtable": {
      "main": [
        [
          {
            "node": "move file to done",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get token": {
      "main": [
        [
          {
            "node": "get server get task",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "upload pdf": {
      "main": [
        [
          {
            "node": "convert to jpg",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Compression": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download file": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "download file": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "convert to jpg": {
      "main": [
        [
          {
            "node": "download file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "get server get task": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Upload your file to google drive": {
      "main": [
        [
          {
            "node": "Download file",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get token",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Test workflow\u2019": {
      "main": [
        [
          {
            "node": "Get token",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}