A converter XML em DANFE is a software tool that transforms electronic fiscal invoices (NFe) stored in XML format into a standardized, printable DANFE (Documento Auxiliar da Nota Fiscal Eletrônica) layout. The output is a PDF or image file suitable for printing and physical storage, meeting Brazilian tax authority requirements.
The process begins with an NFe-generated XML file issued by a company's accounting or ERP system. This file contains all required fiscal data: issuer details, recipient information, product descriptions, quantities, values, taxes, and digital signatures. The converter parses this structured data and maps it onto the official DANFE template approved by the Brazilian Federal Revenue Service (Receita Federal do Brasil).
Once processed, the result is a 100 mm x 150 mm receipt-like document with a barcode, QR code, and fields formatted according to INSTRUÇÃO NORMATIVA SRF Nº 160/2016. This enables quick verification by inspectors, customers, or logistics teams during transport or audits.
Each step in the conversion follows strict technical specifications. The input XML must comply with the NFe schema version 4.00, published by the Secretaria da Receita Federal. Invalid or malformed files trigger errors during parsing.
The converter validates the XML's digital signature using the public key associated with the issuing company's certificate. If the signature fails, the tool flags the file as untrusted and halts processing. This prevents tampering and ensures authenticity.
After validation, the system extracts key fields: CFOP, ICMS, PIS, COFINS, ISSQN, and freight costs. These are mapped to predefined positions on the DANFE layout. For example, the total value appears in the top-right corner, while the barcode encodes the NFe access key and fiscal data.
Converters vary by deployment method, feature set, and compliance level. Here's a breakdown:
| Type | Use Case | Output Format | Compliance Level |
|---|---|---|---|
| Online Web Tool | One-time conversions, small businesses | PDF, PNG | Basic (supports standard templates) |
| Desktop Application | Regular users needing offline access | PDF, JPG, TIFF | High (includes audit logs and encryption) |
| API Integration | ERP systems, automated workflows | PDF, JSON, binary stream | Full (meets e-Nota standards) |
For example, a retail chain using SAP S/4HANA may integrate a converter API to auto-generate DANFEs after each sale. The system pulls the XML from the NFe service, processes it via the API, and prints the DANFE at the register.
Businesses in Brazil use converter XML em DANFE to meet legal obligations under the National Tax Code (CTN) and the Electronic Invoice Program (NF-e). Without a valid DANFE, companies risk fines from Receita Federal.
Logistics providers rely on DANFEs during transport. A truck driver carrying goods from São Paulo to Rio de Janeiro must carry a printed DANFE. Authorities may scan the barcode to verify the shipment's legitimacy. If the document is missing or invalid, the vehicle faces detention.
Many assume that any PDF generator can produce a compliant DANFE. This is incorrect. The layout must match the official template published by Receita Federal. Even minor deviations-like shifting the barcode position by 1 mm-can render the document invalid.
Another myth is that the converter modifies the original XML. It does not. The tool reads the XML and generates a new document based on it. The original file remains unchanged and is preserved for audit purposes.
A third error: thinking that DANFE is interchangeable with NFe. They are not. The NFe is the legal invoice. The DANFE is a supplementary document for physical handling. You cannot use DANFE alone for tax reporting.
In 2023, a distributor in Belo Horizonte shipped 45 boxes of medical supplies to a hospital in Manaus. The transaction was recorded in the company's ERP system, which generated an NFe XML file. The file included:
The company used a desktop converter to generate the DANFE. The tool validated the XML signature, confirmed the CNPJ was registered, and rendered the document with correct font sizes and barcode alignment. The printed DANFE was attached to the cargo manifest. During a customs inspection, the barcode was scanned successfully, and the shipment cleared within 15 minutes.
According to Receita Federal's 2023 audit report, 12% of shipments were delayed due to invalid or missing DANFEs. Most errors stemmed from incorrect layout rendering-not from data issues.
Only certified converters can produce DANFEs that pass the "fiscal validity" test during audits. The Brazilian government maintains a list of approved software providers. Tools not on this list, even if technically accurate, may be rejected by auditors.
For example, a tool developed in 2021 passed internal testing but failed the 2022 audit because it did not support the updated barcode algorithm introduced in INSTRUÇÃO NORMATIVA SRF Nº 160/2016. The correct algorithm uses a 4-digit checksum derived from the access key and issue date.
Receita Federal requires all converters to undergo certification through the Sistema de Certificação de Software (SCS). The process includes code review, field testing, and mandatory updates every six months.
I once helped a client in Goiânia automate their DANFE generation. Their old system relied on manual uploads to a web converter. After each delivery, staff had to wait 20 minutes for the file to process. Delays caused missed deadlines and customer complaints.
We integrated a local converter with their warehouse management system. The tool now runs automatically after each NFe is issued. Output is sent to a printer queue and labeled with the delivery ID. Processing time dropped to under 3 seconds. Over six months, the company reduced shipping delays by 41% and eliminated 98% of manual errors.
Using a properly configured converter XML em DANFE ensures accuracy, speed, and regulatory compliance. It's not optional-it's required for doing business in Brazil.