Skip to content

Feature Request: Support for password-protected documents (PDF, DOCX, XLSX) #1585

@fuleinist

Description

@fuleinist

Problem

Many business documents are password-protected for security, but MarkItDown currently fails to convert them, throwing errors instead of gracefully handling the situation.

Use Case

Users often need to process password-protected documents through automated pipelines. Currently, they must either:

  1. Manually remove passwords before processing
  2. Use external tools to strip passwords
  3. The tool simply fails with an unhelpful error

Proposed Solution

Add optional password parameters to the MarkItDown class and CLI:

Python API

from markitdown import MarkItDown

md = MarkItDown()
result = md.convert("protected.pdf", password="mypassword")
result = md.convert("protected.docx", password="mypassword")
result = md.convert("protected.xlsx", password="mypassword")

CLI

markitdown protected.pdf --password mypassword
markitdown protected.docx -p mypassword

Implementation Suggestions

  1. Add optional password parameter to the convert() method
  2. Add --password / -p CLI flag
  3. For PDF: Use pypdf or PyPDF2's encryption support
  4. For DOCX: Use python-docx's decrypter or mammoth's options
  5. For XLSX: Use openpyxl's workbook encryption handling
  6. Return a clear error message if password is incorrect or not provided

Behavior

  • If password-protected and no password provided: Show clear error message
  • If wrong password: Show "incorrect password" error
  • If password correct: Process normally

This would make MarkItDown much more useful in enterprise environments where document security is common.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions