n8n-nodes-ocrbro 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +158 -0
- package/dist/nodes/OcrBro/OcrBro.node.js +40 -1
- package/package.json +3 -2
- package/eng.traineddata +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# n8n-nodes-ocrbro
|
|
2
|
+
|
|
3
|
+
Extract text from images and PDFs in your n8n workflows. This community node provides OCR (Optical Character Recognition) for images using Tesseract.js and text extraction from PDF documents.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **OCR from Images** - Extract text from PNG, JPG, TIFF, BMP, and other image formats using Tesseract.js
|
|
10
|
+
- **Extract Text from PDFs** - Pull text content from PDF documents
|
|
11
|
+
- **Multi-language Support** - OCR supports 100+ languages via Tesseract language packs
|
|
12
|
+
- **No External APIs** - All processing happens locally, no data leaves your server
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
### Via n8n Community Nodes (Recommended)
|
|
17
|
+
|
|
18
|
+
1. Open your n8n instance
|
|
19
|
+
2. Go to **Settings** → **Community Nodes**
|
|
20
|
+
3. Click **Install a community node**
|
|
21
|
+
4. Enter: `n8n-nodes-ocrbro`
|
|
22
|
+
5. Click **Install**
|
|
23
|
+
6. Restart n8n when prompted
|
|
24
|
+
|
|
25
|
+
## Video Tutorials
|
|
26
|
+
|
|
27
|
+
### 1. How to install ocrbro n8n node for free?
|
|
28
|
+
[](https://youtu.be/v-SByxejyQ8)
|
|
29
|
+
|
|
30
|
+
### 2. Example PDF Text Extraction
|
|
31
|
+
[](https://youtu.be/JpXKcSkO61o)
|
|
32
|
+
|
|
33
|
+
### 3. Example Image Text extraction OCR
|
|
34
|
+
[](https://youtu.be/sZb9GHWbtbo)
|
|
35
|
+
|
|
36
|
+
### 4. How to create Private n8n PDF text extraction API endpoint on n8n
|
|
37
|
+
[](https://youtu.be/sZb9GHWbtbo)
|
|
38
|
+
|
|
39
|
+
### 5. How to create Private n8n Image text extraction API endpoint on n8n
|
|
40
|
+
[](https://youtu.be/crR1N8z0IHw)
|
|
41
|
+
|
|
42
|
+
### Via npm (Self-hosted)
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
cd ~/.n8n/nodes
|
|
46
|
+
npm install n8n-nodes-ocrbro
|
|
47
|
+
# Restart n8n
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Docker
|
|
51
|
+
|
|
52
|
+
Mount the node into your n8n container:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
docker run -it --rm \
|
|
56
|
+
--name n8n \
|
|
57
|
+
-p 5678:5678 \
|
|
58
|
+
-e N8N_CUSTOM_EXTENSIONS="/home/node/.n8n/custom/n8n-nodes-ocrbro" \
|
|
59
|
+
-v n8n_data:/home/node/.n8n \
|
|
60
|
+
docker.n8n.io/n8nio/n8n
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Usage
|
|
64
|
+
|
|
65
|
+
### OCR from Image
|
|
66
|
+
|
|
67
|
+
Extract text from images using Tesseract OCR.
|
|
68
|
+
|
|
69
|
+
1. Add **OCR Bro** node to your workflow
|
|
70
|
+
2. Set **Operation** to `OCR from Image`
|
|
71
|
+
3. Configure:
|
|
72
|
+
- **Input Binary Field**: Name of the binary property containing the image (default: `data`)
|
|
73
|
+
- **Language**: Tesseract language code (default: `eng`)
|
|
74
|
+
|
|
75
|
+
**Example workflow:**
|
|
76
|
+
```
|
|
77
|
+
[Read Binary File] → [OCR Bro] → [Set Node]
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Supported image formats:** PNG, JPG/JPEG, TIFF, BMP, GIF, WebP
|
|
81
|
+
|
|
82
|
+
**Language codes:**
|
|
83
|
+
- `eng` - English
|
|
84
|
+
- `deu` - German
|
|
85
|
+
- `fra` - French
|
|
86
|
+
- `spa` - Spanish
|
|
87
|
+
- `chi_sim` - Chinese (Simplified)
|
|
88
|
+
- `jpn` - Japanese
|
|
89
|
+
- Multiple languages: `eng+deu+fra`
|
|
90
|
+
|
|
91
|
+
### Extract Text from PDF
|
|
92
|
+
|
|
93
|
+
Extract text content from PDF documents.
|
|
94
|
+
|
|
95
|
+
1. Add **OCR Bro** node to your workflow
|
|
96
|
+
2. Set **Operation** to `Extract Text from PDF`
|
|
97
|
+
3. Configure:
|
|
98
|
+
- **Input Binary Field**: Name of the binary property containing the PDF (default: `data`)
|
|
99
|
+
|
|
100
|
+
**Example workflow:**
|
|
101
|
+
```
|
|
102
|
+
[HTTP Request (PDF URL)] → [OCR Bro] → [Code Node]
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**Output:**
|
|
106
|
+
```json
|
|
107
|
+
{
|
|
108
|
+
"text": "Extracted text content...",
|
|
109
|
+
"pages": 5
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Examples
|
|
114
|
+
|
|
115
|
+
### Basic Image OCR
|
|
116
|
+
|
|
117
|
+
1. Use **Read Binary File** to load an image
|
|
118
|
+
2. Connect to **OCR Bro** with operation `OCR from Image`
|
|
119
|
+
3. Output contains `text`, `confidence`, and `words` count
|
|
120
|
+
|
|
121
|
+
### Batch Process Images
|
|
122
|
+
|
|
123
|
+
1. Use **Read Binary Files** to load multiple images
|
|
124
|
+
2. Connect to **OCR Bro**
|
|
125
|
+
3. Each item will be processed and return extracted text
|
|
126
|
+
|
|
127
|
+
### Process PDF and Send via Email
|
|
128
|
+
|
|
129
|
+
1. **HTTP Request** - Download PDF from URL
|
|
130
|
+
2. **OCR Bro** - Extract text (operation: `Extract Text from PDF`)
|
|
131
|
+
3. **Send Email** - Include extracted text in email body
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
## Troubleshooting
|
|
136
|
+
|
|
137
|
+
### Node not appearing after installation
|
|
138
|
+
- Restart your n8n instance
|
|
139
|
+
- Check the n8n logs for any errors
|
|
140
|
+
|
|
141
|
+
### Low OCR accuracy
|
|
142
|
+
- Use higher resolution images (300 DPI recommended)
|
|
143
|
+
- Ensure good contrast between text and background
|
|
144
|
+
- Specify the correct language code
|
|
145
|
+
- Pre-process images to remove noise if needed
|
|
146
|
+
|
|
147
|
+
### PDF extraction returns empty text
|
|
148
|
+
- The PDF may contain scanned images instead of text
|
|
149
|
+
- For scanned PDFs, convert pages to images first, then use the OCR operation
|
|
150
|
+
|
|
151
|
+
## License
|
|
152
|
+
|
|
153
|
+
MIT
|
|
154
|
+
|
|
155
|
+
## Links
|
|
156
|
+
|
|
157
|
+
- [npm Package](https://www.npmjs.com/package/n8n-nodes-ocrbro)
|
|
158
|
+
- [n8n Community Nodes](https://docs.n8n.io/integrations/community-nodes/)
|
|
@@ -89,6 +89,34 @@ class OcrBro {
|
|
|
89
89
|
},
|
|
90
90
|
},
|
|
91
91
|
},
|
|
92
|
+
{
|
|
93
|
+
displayName: 'Password Protected?',
|
|
94
|
+
name: 'isPasswordProtected',
|
|
95
|
+
type: 'boolean',
|
|
96
|
+
default: false,
|
|
97
|
+
description: 'Whether the PDF file is encrypted/password protected',
|
|
98
|
+
displayOptions: {
|
|
99
|
+
show: {
|
|
100
|
+
operation: ['extractPdf'],
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
displayName: 'Password',
|
|
106
|
+
name: 'password',
|
|
107
|
+
type: 'string',
|
|
108
|
+
typeOptions: {
|
|
109
|
+
password: true,
|
|
110
|
+
},
|
|
111
|
+
default: '',
|
|
112
|
+
description: 'The password required to unlock the PDF document',
|
|
113
|
+
displayOptions: {
|
|
114
|
+
show: {
|
|
115
|
+
operation: ['extractPdf'],
|
|
116
|
+
isPasswordProtected: [true],
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
},
|
|
92
120
|
],
|
|
93
121
|
};
|
|
94
122
|
}
|
|
@@ -156,7 +184,18 @@ class OcrBro {
|
|
|
156
184
|
if (mimeType !== 'application/pdf') {
|
|
157
185
|
throw new Error(`Expected PDF file but got: ${mimeType}. Use "OCR from Image" for image files.`);
|
|
158
186
|
}
|
|
159
|
-
|
|
187
|
+
let pdfBufferToProcess = new Uint8Array(binaryData);
|
|
188
|
+
const isPasswordProtected = this.getNodeParameter('isPasswordProtected', i, false);
|
|
189
|
+
if (isPasswordProtected) {
|
|
190
|
+
const password = this.getNodeParameter('password', i);
|
|
191
|
+
const { PDFDocument } = await Promise.resolve().then(() => __importStar(require('@yongseok_choi/pdf-lib')));
|
|
192
|
+
const pdfDoc = await PDFDocument.load(binaryData, {
|
|
193
|
+
password: password,
|
|
194
|
+
ignoreEncryption: true,
|
|
195
|
+
});
|
|
196
|
+
pdfBufferToProcess = (await pdfDoc.save());
|
|
197
|
+
}
|
|
198
|
+
const pdf = await getDocumentProxy(pdfBufferToProcess);
|
|
160
199
|
const { text, totalPages } = await extractText(pdf, { mergePages: true });
|
|
161
200
|
returnData.push({
|
|
162
201
|
json: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-ocrbro",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Native n8n node for OCR using Tesseract.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
]
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
|
-
"build": "tsc",
|
|
27
|
+
"build": "tsc && bash copy_assets.sh",
|
|
28
28
|
"dev": "tsc --watch",
|
|
29
29
|
"test": "ts-node test/test.ts"
|
|
30
30
|
},
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"typescript": "^5.0.0"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
+
"@yongseok_choi/pdf-lib": "^2.2.6",
|
|
45
46
|
"pdf2json": "^4.0.0",
|
|
46
47
|
"tesseract.js": "^4.0.0",
|
|
47
48
|
"unpdf": "^1.4.0"
|
package/eng.traineddata
DELETED
|
Binary file
|