AI for Freight Forwarder - AI Agent Extract Booking PDF to Odoo
- Bernard Bryan Hayashi
- Feb 25
- 3 min read
Overview
In the freight forwarding industry, booking documents are still commonly exchanged in PDF format via email. These PDFs often contain critical information such as shipper details, consignee, ports, container types, ETD/ETA, and cargo descriptions. Unfortunately, this information is unstructured, meaning it cannot be directly consumed by ERP systems like Odoo without manual data entry.
This blog explains why and how we can use an AI-powered workflow to automatically extract booking information from PDF files and prepare it for integration into Odoo. The approach significantly reduces manual work, minimizes human error, and speeds up booking processing.
Why Do We Need This Workflow?
1. Manual Data Entry Is Inefficient
Freight operators often need to manually read PDFs and retype the information into Odoo. This process is:
Time-consuming
Error-prone
Not scalable when booking volume increases
2. PDF Files Are Unstructured
Most booking confirmations are not machine-readable tables. Even when text-based, layouts vary between shipping lines and agents, making traditional rule-based extraction unreliable.
3. AI Can Understand Context
By combining PDF text extraction with Large Language Models (LLMs), we can:
Extract text from PDF file
Identify relevant booking fields
Retrieve booking data in a structured JSON format suitable for Freight Booking API
High-Level Architecture
PDF file (Booking Confirmation)
n8n workflow to orchestrate automation
AI model (using Ollama) for identifying and retrieving specific booking fields
Odoo as the final destination system
Software & Tools Required
Before starting, make sure the following software is installed and configured:
1. Docker
Used to run n8n locally in a containerized environment.
2. n8n (Self-hosted)
An open-source workflow automation tool used to design and execute the PDF extraction pipeline.
3. Ollama
Runs local LLM models (e.g., Qwen3)
4. Odoo (Target System)
ERP system where the extracted booking data will eventually be inserted (Sales Order / Shipment / Booking module).
Step-by-Step Workflow Setup in n8n
Click “or start from a template” to faster the workflow creation

Click “See more templates”

Search for “extract pdf file”

Click the “Extract text from a PDF file” template

Click “Use for free” button

Click “Copy template to clipboard (JSON)” then create a new .json file and paste the copied json to the json file

Open your new workflow and click the three dots icon and click “Import from File…” then upload the json file

You can start modifying the workflow template

Double click the “Read Binary File” node and change the “File Path” to your pdf file path (please refer to Local N8N Installation Using Docker blog for the path file)

Click the “Execute step” button to test if the node can read the file path correctly

Click “Execute Workflow” button to ensure all nodes run correctly

Double click the “Read PDF” node and check whether the output generates a JSON containing the text of the PDF file

Add a new node by clicking the plus icon on the right side of the last node, then choose “Core” => “Code” => “Code in JavaScript”

Add this new node to sanitize the extracted text


Execute the node, and it should return the sanitized text

Add another “Code in JavaScript” node to return a JSON object containing an array of strings. These ports will be used to map the port names from the PDF with the available ports in the database.

Execute the node, and it should return an object containing an array of available ports

Add a new node “Core” => “HTTP Resquest” to call Ollama API and access the Qwen3 model. Use the request method, url, headers, and body as shown in the screenshots below. This request will extract booking pdf information and generate a suitable JSON for the Freight Booking API




Create a new “HTTP Request” node to generate a Session ID. This Session ID will be used for the Freight Booking Create API request


Create another “HTTP Request” node to create a dummy booking record

Congrats the booking record has been successfully created



Comments