Install
openclaw skills install pdf2word-skillsConvert scanned PDF documents into Word text documents using a free, local OCR engine or remote api.
openclaw skills install pdf2word-skillsA skill to extract text from scanned PDF documents and convert them into reusable Word (.docx) files using the free, local docr OCR engine.
bash scripts/install.sh
pip install -r scripts/requirements.txt
Run the Python script passing the input PDF file and the desired output .docx file path. You can also append any additional standard docr arguments (such as engine preferences).
python scripts/pdf2word.py <input.pdf> <output.docx> [docr_args...]
Convert a single file with the default local engine:
python scripts/pdf2word.py sample.pdf sample_output.docx
By default, the script uses the local RapidOCR engine. The underlying docr tool also supports other engines like the Google Gemini API for potentially higher recognition accuracy on complex layouts.
To use Gemini, first configure your API key:
mkdir -p ~/.ocr
echo "gemini_api_key=your_gemini_key" > ~/.ocr/config
Then pass the -engine gemini argument to the script:
python scripts/pdf2word.py sample.pdf sample_output.docx -engine gemini
If your document has tables, you can force Gemini to output them in Markdown format so the script can parse them into native Word tables:
python scripts/pdf2word.py sample.pdf sample_output.docx -engine gemini -prompt "Extract all text and preserve tables in Markdown format using | symbols."
docr, which uses the specified OCR model (RapidOCR by default) to read text from the scanned PDF.python-docx library is used to read the temporary text and construct a formatted Word document.