Mistral OCR Unofficial
An unofficial VS Code extension that performs Optical Character Recognition (OCR) on PDF files using the Mistral AI API, saving the results in a folder with the same name as the PDF.
Features
- Right-click on PDF files in the VS Code Explorer to perform OCR processing
- Configure your Mistral AI API Key in settings
- Automatically saves OCR results in a folder with the same name as the PDF
- Extracts and saves images from the PDF
- Automatically opens the generated Markdown file after processing
- Handles multi-page PDF documents
- Provides detailed error messages and troubleshooting assistance
Prerequisites
- Python 3.6 or higher
- The
mistralai
Python package (pip install mistralai
)
- A valid Mistral AI API Key with OCR permissions
- Internet connection (for calling the Mistral AI API)
Installation
From VSIX File
Ensure Python is installed and required dependencies are set up:
pip install mistralai
In VS Code, go to the Extensions view (Ctrl+Shift+X)
Click the "..." button and select "Install from VSIX..."
Select the downloaded VSIX file
From VS Code Marketplace
- Open VS Code
- Go to the Extensions view (Ctrl+Shift+X)
- Search for "Mistral OCR Unofficial"
- Click Install
Setting Up Your API Key
There are two ways to set up your Mistral AI API Key:
- Go to VS Code Settings (File > Preferences > Settings)
- Search for "Mistral OCR"
- Enter your API Key in the "Mistral AI API Key" field
Alternatively, you'll be prompted to enter your API Key the first time you use the extension.
Usage
- In VS Code's Explorer, right-click on a PDF file
- Select "Process PDF with Mistral OCR" from the context menu
- Wait for the processing to complete
- The results will be saved in a folder with the same name as the PDF file, and the Markdown file will open automatically
How It Works
- The extension calls a Python script to process the PDF file
- The PDF file is uploaded to the Mistral AI service
- The Mistral OCR API processes the file
- Images are extracted and saved
- Markdown text is generated and processed
- Results are saved to a folder with the same name as the PDF
Troubleshooting
If the extension isn't working correctly:
- Make sure Python is installed correctly (check by running
python --version
or python3 --version
in your terminal)
- Ensure the necessary Python package is installed:
pip install mistralai
- Check for error messages in the VS Code output window
- Verify that your API Key is valid and has OCR permissions
- Check that your internet connection is working properly
Privacy Notice
This extension processes PDF files using the Mistral AI API. Your PDF files are uploaded to Mistral's servers for OCR processing. Please ensure you have permission to upload any PDF files you process. This extension is not affiliated with or endorsed by Mistral AI.
Contributing
Contributions are welcome! Feel free to open issues or submit pull requests on the GitHub repository.
License
This project is licensed under the MIT License - see the license file for details.
Note: This is an unofficial extension and is not affiliated with, endorsed by, or sponsored by Mistral AI.