skillfed

BrazilFiscalReport

Python library for generating Brazilian auxiliary fiscal documents in PDF from XML documents.

brazilfiscalreport v1.0.1 85.5K downloads/30d#13,918 on PyPI115
AGPL 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) Active released

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 brazilfiscalreport

uv

uv add brazilfiscalreport

poetry

poetry add brazilfiscalreport

Installing 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

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: GNU Affero General Public License v3Operating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python Modules

Tags

brazilian fiscal document pdf generationnf-e danfe xml to pdfbrazilian invoice pdf convertersefaz fiscal document rendererct-e dacte pdf from xmlmdf-e damdfe generatornfs-e danfse pdf output
brazil-fiscalpdf-generationxml-processing

More Python Modules packages