Mineru icon

Mineru

Use Mineru API to parse PDF, documents, and images, automatically create tasks and wait for results

Overview

This node integrates with the Mineru API to parse various document and image formats, including PDF, DOC, DOCX, PPT, PPTX, PNG, JPG, and JPEG. It automates the process of creating parsing tasks on the Mineru service, waits for their completion, and retrieves the parsed results as downloadable ZIP files.

Common scenarios where this node is beneficial include:

  • Extracting structured data such as text, tables, and formulas from scanned documents or images.
  • Automating document processing workflows that require OCR (Optical Character Recognition) for image-based documents.
  • Converting documents into multiple export formats for further analysis or storage.
  • Handling large documents by specifying page ranges to parse only relevant sections.

Practical example:

  • A user uploads a scanned PDF invoice and wants to extract tabular data and formulas automatically. They enable OCR and table/formula recognition, specify the language as English, and receive a ZIP file containing the parsed content in markdown, JSON, and optionally other formats like DOCX or HTML.

Properties

Name Meaning
Document URL The URL of the document to be parsed. Supports PDF, DOC, DOCX, PPT, PPTX, PNG, JPG, and JPEG formats.
Enable OCR Whether to enable OCR functionality to recognize text in images.
Enable Formula Recognition Whether to enable formula recognition functionality.
Enable Table Recognition Whether to enable table recognition functionality.
Document Language Specify the document language. Options: Chinese, Automatic detection, English.
Data ID Optional identifier string to tag your business data for easier tracking.
Page Range Specify which pages to parse, e.g., "1-10,15,20-25".
Extra Export Format Additional export formats besides default markdown and JSON. Options: DOCX, HTML, LaTeX.
Model Version Mineru model version to use. Options: V1, V2.
Polling Interval (Seconds) Time interval in seconds to check the status of the parsing task.
Maximum Waiting Time (Minutes) Maximum time in minutes to wait for the parsing task to complete before timing out.

Output

The node outputs an array of items, each corresponding to an input item processed. Each output item contains:

  • json:
    • fileName: The name of the downloaded ZIP file containing the parsed document results.
    • fileSize: Size of the ZIP file in bytes.
    • In case of errors, an error field with the error message.
  • binary:
    • data: The ZIP file content encoded in base64.
    • Metadata fields such as mimeType ("application/zip"), fileName, fileExtension ("zip"), and fileSize.

The ZIP archive includes the parsed document data in markdown and JSON formats by default, plus any additional export formats requested.

Dependencies

  • Requires an API key credential for authenticating with the Mineru API.
  • Network access to Mineru's API endpoints (https://mineru.net/api/v4/extract/task and related URLs).
  • No additional external dependencies beyond standard HTTP request capabilities provided by n8n.

Troubleshooting

  • Document URL empty or invalid: The node throws an error if the Document URL is missing or blank. Ensure the URL is correct and accessible.
  • API token verification failure: If the API key is invalid or expired, the node will fail to create tasks. Verify the API key and permissions.
  • Task creation failure: Errors returned by the Mineru API during task creation are surfaced. Check the error message for details.
  • Task parsing failure: If the parsing task fails on the server side, the node reports the failure with the error message from Mineru.
  • Timeout waiting for task completion: If the task does not complete within the specified maximum waiting time, the node throws a timeout error. Increase the maximum waiting time or check the document size and complexity.
  • File download failure: If the ZIP file cannot be downloaded after task completion, the node either throws an error or continues with an error message depending on the "Continue On Fail" setting.
  • Unsupported document formats or corrupted files: May cause parsing failures; verify the input document format and integrity.

Links and References

Discussion