All posts
PDF to text via CLI
Extract TXT, Markdown, or HTML with OpenDataLoader, then optionally convert HTML to DOCX with soffice.
Open online converterPackages to install
The engine is a Java CLI plus a JRE 11+. For DOCX you also need LibreOffice Writer. A wrapper named opendataloader-pdf is optional.
default-jre-headless
libreoffice-writer-nogui
fonts-liberation
sudo apt-get update
sudo apt-get install -y default-jre-headless libreoffice-writer-nogui fonts-liberationHow to run the command
opendataloader-pdf document.pdf -o . -f html --image-output off writes document.html. -f text writes document.txt, -f markdown writes document.md. For Word: convert the HTML with soffice --headless --convert-to docx document.html.
opendataloader-pdf document.pdf -o . -f html --image-output offDockerfile example
Build a minimal Ubuntu image with the required packages and run the conversion inside the container.
FROM ubuntu:24.04
RUN apt-get update && \
apt-get install -y --no-install-recommends \
default-jre-headless \
libreoffice-writer-nogui \
fonts-liberation && \
rm -rf /var/lib/apt/lists/*
WORKDIR /work
docker build -t pdf-to-text .
docker run --rm -v "$PWD:/work" -w /work pdf-to-text \
opendataloader-pdf document.pdf -o . -f html --image-output offExample commands
Run these locally after installing the packages, or inside the container from the Dockerfile.
opendataloader-pdf document.pdf -o . -f html --image-output offopendataloader-pdf document.pdf -o . -f text --image-output offjava -jar opendataloader-pdf-cli.jar document.pdf -o . -f markdown --image-output offopendataloader-pdf document.pdf -o ./output -f html --image-output off && soffice --headless --convert-to docx --outdir ./output document.html