BrazilFiscalReport
Python library for generating Brazilian auxiliary fiscal documents in PDF from XML documents.
What it is and what it does
BrazilFiscalReport is a Python library that transforms authorized Brazilian electronic invoice XML files into the official printable PDF documents required by Brazilian tax law. It handles four main document types—DANFE (goods invoice), DACTE (freight bill), DAMDFE (cargo manifest), and DANFSe (service invoice)—plus the DACCe correction-letter event. The library is built on fpdf2 and requires no external tools like wkhtmltopdf or headless browsers.
The package provides three usage patterns: a Python API for programmatic control, a command-line tool (bfrep) for batch processing, and an online demo. It supports customization of issuer logos, margins, fonts, decimal precision, and watermarks. The library is actively maintained, supports Python 3.8 through 3.13, and carries no known security vulnerabilities.
Use it for:
- Generate DANFE PDFs from NF-e XML in ERP systems to print and attach to shipments
- Batch-convert fiscal XML documents to PDFs for archival or compliance reporting
- Customize fiscal document appearance with company logos and specific margin/font settings
- Integrate fiscal document generation into web applications via the Python API
- Process correction-letter events (CC-e) and output DACCe PDFs for tax adjustments
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Converts Brazilian electronic invoice XML files (NF-e, CT-e, MDF-e, NFS-e) into official printable PDF documents (DANFE, DACTE, DAMDFE, DANFSe) and generates correction-letter PDFs (DACCe).
Yes, if you work with Brazilian electronic invoicing. The library solves a specific, regulated problem with low install friction, active maintenance, and no security issues. LGPL-3.0 licensing is permissive for most use cases. The Beta status and optional extras warrant verification of production readiness for your specific document types before deployment.
Install
brazilfiscalreport on PyPI
pip
pip install brazilfiscalreportuv
uv add brazilfiscalreportpoetry
poetry add brazilfiscalreportInstalling BrazilFiscalReport
Before you install
Low friction install with pure-Python dependencies (fpdf2, phonenumbers, python-barcode). Active maintenance with recent releases; last commit 2026-08-14. Tested across Python 3.8 through 3.13.
License in practice
Licensed under LGPL-3.0, which permits commercial use and modification provided derivative works remain under the same license and source code is made available. Suitable for proprietary applications that link to the library.
Quickstart
from brazilfiscalreport.danfe import Danfe
with open('nfe.xml', 'r', encoding='utf8') as file:
xml_content = file.read()
danfe = Danfe(xml=xml_content)
danfe.output('danfe.pdf')
Requires authorized XML from SEFAZ (Brazilian tax authority) after invoice approval; raw XML alone is insufficient.
Verify before relying
- Whether optional extras (dacte, damdfe, danfse, cli) are production-ready or still experimental given Beta status
- Performance characteristics when processing large batches of fiscal documents
- Compliance with current SEFAZ specifications and any recent regulatory changes
Package facts
| License | GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this… (full text in the JSON record) (agpl) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — fpdf2, phonenumbers, python-barcode |
| Maintenance | actively maintained — 43 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 85,540/month — #13,918 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: brazilfiscalreport-1.0.1-py3-none-any.whl
Keywords: nfe, nf-e, danfe, cte, ct-e, dacte, mdfe, mdf-e, damdfe, cce, cc-e, dacce, nfse, nfs-e, danfse, xml, pdf, sefaz, brazil, brasil, nota-fiscal-eletronica, documento, fiscal, auxiliar, converter, generator
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
drafthorseGenerates and parses ZUGFeRD XML invoice…
permissive · top 15,000 on PyPI
factur-xGenerates, validates, and extracts Factur-X,…
permissive · top 15,000 on PyPI
validate-docbrValidates and generates Brazilian identity and…
permissive · top 15,000 on PyPI
python-codicefiscaleEncodes and decodes Italian fiscal codes…
permissive · top 15,000 on PyPI
fpdf2fpdf2 generates PDF documents programmatically…
copyleft · top 5,000 on PyPI
python-bcbStructured Python interface to fetch Brazilian…
unclear · top 15,000 on PyPI
brazilnumValidates and formats Brazilian identification…
permissive · top 15,000 on PyPI
nsj-gcf-utilsProvides utility modules for building Google…
unclear · top 15,000 on PyPI
sphinx-simplepdfSphinx-SimplePDF is a Sphinx extension that…
permissive · top 15,000 on PyPI
landingai-adeConverts PDFs and images into structured…
permissive · top 15,000 on PyPI