0.1.0 - 2026-11-29

Features

  • SefazDanfe.render/2 and SefazDanfe.data/2: DANFE (NF-e 55), DANFE NFC-e (65), DACTE (CT-e 57 and CT-e OS 67) and DAMDFE (MDF-e 58) from the authorized XML, extracted from the TaxDoc application. The document is detected from the XML; the options are :canceled and :closed.
  • DANFE of the NF-e with canhoto, access key (CODE-128C), protocol, items with lot and infAdProd, ISSQN, the IBS, CBS and IS totals of the tax reform, several sheets ("Folha N/M") with the header and titles repeated, and the additional data at the foot of the last sheet.
  • "SEM VALOR FISCAL" in homologation and "CANCELADA" for a canceled NF-e or NFC-e; :closed marks a closed MDF-e.
  • DANFE NFC-e (80 mm) with the QR code 2.00.
  • Contingency notices by tpEmis, checked against the official manuals (MOC 7.0 Anexo II and III, DACTE and DAMDFE MOC 3.00a, NT 2026.004; sources in the docs of SefazDanfe.Contingency):
    • NF-e FS-IA/FS-DA: "DANFE EM CONTINGÊNCIA - IMPRESSO EM DECORRÊNCIA DE PROBLEMAS TÉCNICOS" and the second barcode "DADOS DA NF-E" (Code 128C of 36 digits, in place of the consulta URL) with its numeric form in the protocol box; EPEC: "DANFE impresso em contingência - EPEC regularmente recebida pela Receita Federal do Brasil" and the box "PROTOCOLO DE AUTORIZAÇÃO DO EPEC"; SVC prints as a normal emission. In every contingency the entry time (dhCont) and the reason (xJust) go in the additional data.
    • NFC-e offline (tpEmis 9): "EMITIDA EM CONTINGÊNCIA" and "Pendente de autorização" below the header and below the identification, with no protocol line and no dhCont / xJust.
    • CT-e FS-DA: the notice and the second barcode "DADOS DO CT-E"; EPEC, offline (tpEmis 2) and SVC have no notice (the manuals define none).
    • MDF-e: "EMISSÃO EM CONTINGÊNCIA" in the place of the authorization protocol. The data maps carry "emission_type" and "contingency" (and "print_type" for the NFC-e), and "contingency_code" ("digits", "formatted") for the NF-e FS-IA/FS-DA and the CT-e FS-DA.
  • SefazDanfe.ContingencyCode: the 36 digits of the second barcode of the FS-IA/FS-DA documents.
  • :copy option for the DANFE NFC-e: :consumer (default) or :establishment, which prints "Via do Estabelecimento" next to the emission date and time.
  • :logo option ({:png, binary} or {:svg, binary}): drawn in the emitter block of the DANFE (portrait and landscape), DANFE NFC-e, DACTE and DAMDFE; passed to Typst as a virtual file.
  • :paper option for the DANFE NFC-e: :mm80 (default) or :mm58.
  • SefazDanfe.Contingency.
  • Landscape DANFE of the NF-e (tpImp 2): A4 on its side with the vertical canhoto on the left, every block of the portrait, several sheets and the cancel and homologation marks. New option orientation: :auto | :portrait | :landscape (default :auto, from the tpImp of the XML); SefazDanfe.data/2 carries print_type. The landscape DANFE also carries the contingency notices and the logo.
  • Telemetry span [:sefaz_danfe, :render].
  • Golden tests (test/golden): the text and a 50 dpi raster of 18 renders (every layout, multi sheet, canceled, homologation, contingency, logo), plus the decoding of the CODE-128 and QR codes of the PDFs with zbarimg at 300 dpi. GOLDEN_UPDATE=1 mix test test/golden rewrites the expected files.
  • Guide guides/layouts.md with a preview and the call of each layout, and scripts/previews.exs that regenerates the previews.
  • IBM Plex Sans (OFL 1.1) bundled in priv/fonts; no font is read from the system.

Dependencies

  • sefaz_nfe ~> 0.4.3 or ~> 0.5.0, typst == 0.4.5, telemetry, decimal.