OFD libraries for Python
- easyofd is the most used Python OFD library. It parses an OFD file into a Python dict (pages, text with positions, images, fonts, seals), draws it to PDF with ReportLab, renders pages to images, and converts PDF or images to OFD. It’s popular for processing Chinese e-invoices. The package is Apache-2.0, but it depends on PyMuPDF, which is AGPL-3.0 or commercial.
For text-only tasks on simple files, you can also read OFD with the standard library: open the ZIP with zipfile, follow OFD.xml to Document.xml and the page Content.xml files, and collect ofd:TextCode elements with xml.etree.ElementTree.
- easyofd easyofd is a Python library for OFD files. How to install it, convert OFD to PDF and images, extract text with positions from OFD invoices, and convert PDF.