Pandoc Converter

Convert documents using Pandoc

Document → Convert DOCX to Markdown

AI-generated

Overview

This node converts DOCX files to Markdown format using Pandoc. It is useful for workflows that require transforming DOCX documents into Markdown for easier text processing, publishing, or integration with Markdown-based systems. It supports extracting images from the DOCX file and embedding or saving them in various formats, including base64 embedding, reference links, or separate files. Additional Pandoc command line options can be specified for customization.

Use Case Examples

  1. Convert a DOCX file stored in a binary property named 'data' to Markdown, embedding images as base64 data URLs.
  2. Extract images from a DOCX file and save them as separate binary files while converting the document to Markdown.
  3. Generate a clean JSON output with text and separate images array for use with large language models (LLMs).

Properties

Name Meaning
Input Data Field Name Name of the binary property which contains the DOCX file to be converted.
Output Data Field Name Name of the binary property to which to write the converted Markdown file.
Extract Images Whether to extract images from the DOCX file and include them in the output.
Image Output Format How to handle extracted images in the Markdown output.
Additional Pandoc Options Additional command line options to pass to Pandoc for customizing the conversion process.

Output

Binary

Contains the converted Markdown file and optionally extracted images as separate binary files.

JSON

  • conversion
    • originalFileName - Original DOCX file name.
    • outputFileName - Output Markdown or JSON file name.
    • originalSize - Size in bytes of the original DOCX file.
    • convertedSize - Size in bytes of the converted Markdown or JSON content.
    • timestamp - Timestamp of when the conversion was performed.
    • extractedImages - Boolean indicating if images were extracted.
    • imageOutputFormat - Format used for image output if images were extracted.
    • imageCount - Number of images extracted from the DOCX file.

Dependencies

  • Pandoc must be installed and accessible in the system PATH or in common installation directories.

Troubleshooting

  • Ensure the input binary property contains a valid DOCX file; errors occur if missing or empty.
  • Pandoc must be installed on the system; the node tries to locate it on Windows in common paths.
  • If the output file is not created, the conversion failed; check Pandoc command and options.
  • Large images may be replaced with placeholders if exceeding 5MB to avoid embedding huge base64 data.
  • Temporary files and media directories are cleaned up after conversion; permission issues may cause warnings but do not stop execution.

Links

Discussion