Auto Scan DOCX and Image

Scan and classify document contents using OCR or DOCX extraction

Auto Scan DOCX and Image

AI-generated

Overview

This node processes documents or images to extract and classify their textual content automatically. It supports two input types: DOCX files and images. For DOCX files, it extracts raw text directly from the document. For images, it performs Optical Character Recognition (OCR) using a language-specific model to convert image content into text. After extraction, the node classifies the document content into predefined categories such as department and priority, and optionally sends a notification about the processing result.

Common scenarios where this node is beneficial include:

  • Automating data extraction from scanned invoices, receipts, or reports.
  • Digitizing paper documents by converting images to searchable text.
  • Classifying incoming documents for workflow routing based on content.
  • Triggering notifications after document processing in business automation.

Practical example:

  • A user uploads an image of a receipt; the node extracts the text via OCR, classifies it as a finance document with high priority, and sends a notification confirming the process completion.

Properties

Name Meaning
Input Type Choose the input type for OCR scanning. Options: "Image" or "DOCX File".
File URL or Path The URL (starting with http/https) or local file path pointing to the document or image to be scanned.
Language Language used for OCR processing. Options: "English" or "Vietnamese".
Send Notification Boolean flag indicating whether to send a notification after processing (true/false).

Output

The node outputs an array of JSON objects, each containing:

  • extractedText: The raw text extracted from the input document or image.
  • classifiedData: An object with classification results, including:
    • department: Example value "Finance".
    • priority: Example value "High".
    • summary: A brief summary string describing key information extracted.
  • notification: A string indicating if a notification was sent ("Notification sent") or not ("No notification").

The node does not output binary data.

Dependencies

  • External Libraries:

    • mammoth: Used for extracting raw text from DOCX files.
    • tesseract.js: Used for performing OCR on images.
    • axios: Used to fetch image data from URLs.
  • n8n Configurations:

    • Requires internet access if processing images from URLs.
    • No explicit API keys or credentials are required by the node itself.

Troubleshooting

  • Common Issues:

    • Providing a file path that is not accessible or invalid will cause errors.
    • Using an unsupported input type other than "image" or "docx" will throw an error.
    • Image URLs must start with "http" or "https"; otherwise, the node throws an error.
  • Error Messages:

    • "Unsupported input type": Occurs if the input type parameter is set to a value other than "image" or "docx". Solution: Use only supported input types.
    • "Invalid input: URL must start with http/https": Happens when the image URL does not begin with a valid protocol. Solution: Provide a correct URL starting with http or https.
    • "Error processing file: <message>": Generic error wrapper for issues during file reading or OCR. Check the underlying message for details.

Links and References

Discussion