![]() |
VOOZH | about |
dotnet add package Nogueira.NFSe.Danfe.FixLinux --version 1.0.12.2
NuGet\Install-Package Nogueira.NFSe.Danfe.FixLinux -Version 1.0.12.2
<PackageReference Include="Nogueira.NFSe.Danfe.FixLinux" Version="1.0.12.2" />
<PackageVersion Include="Nogueira.NFSe.Danfe.FixLinux" Version="1.0.12.2" />Directory.Packages.props
<PackageReference Include="Nogueira.NFSe.Danfe.FixLinux" />Project file
paket add Nogueira.NFSe.Danfe.FixLinux --version 1.0.12.2
#r "nuget: Nogueira.NFSe.Danfe.FixLinux, 1.0.12.2"
#:package Nogueira.NFSe.Danfe.FixLinux@1.0.12.2
#addin nuget:?package=Nogueira.NFSe.Danfe.FixLinux&version=1.0.12.2Install as a Cake Addin
#tool nuget:?package=Nogueira.NFSe.Danfe.FixLinux&version=1.0.12.2Install as a Cake Tool
Biblioteca .NET para gerar DANFSe (PDF) a partir do XML da NFSe Nacional (DPS/NFSe), sem depender de endpoint externo, permitindo alto volume, baixa latência e customização completa de layout.
Status: operacional em produção nos cenários do autor.
A biblioteca é open source e contribuições são fortemente incentivadas para ampliar compatibilidade com variações reais de XML e regras municipais.
Via NuGet:
dotnet add package Direction.NFSe.Danfe
using Direction.NFSe.Danfe;
var xml = File.ReadAllText("nfse.xml");
var danfe = new DanfeService(new DanfeOptions
{
// Opcional: diretório base para templates e dados
// BasePath = AppContext.BaseDirectory,
// Opcional: template customizado
// TemplatePath = @"C:\meu-layout\Danfe.html"
});
DanfeResult result = danfe.Generate(
xml,
DanfeEnvironment.Production
);
File.WriteAllBytes("danfse.pdf", result.PdfBytes);
using Direction.NFSe.Danfe;
var xml = File.ReadAllText("nfse.xml");
var danfe = new DanfeService();
DanfeResult result = danfe.Generate(
xml,
DanfeEnvironment.Production,
true // Informa que é uma NFSe CANCELADA
);
File.WriteAllBytes("danfse.pdf", result.PdfBytes);
2611606,Recife,-8.04666,-34.8771,1,26,2531,81,America/Sao_Paulo,Assets\Logos\logoRecife.png,Prefeitura do Recife<br>Secretaria de Finanças<br>faleconosco@recife.pe.gov.br
Console.WriteLine(result.Html);
foreach (var warning in result.Warnings)
{
Console.WriteLine($"{warning.Code}: {warning.Message} ({warning.Path})");
}
Exemplo de warning retornado:
NFSE_FIELD_MISSING: Campo vLiq ausente; usando '-' (infNFSe.valores.vLiq)
Esses warnings facilitam:
NFSeSchemaDanfeResult result = danfe.Generate(
nfseSchema,
DanfeEnvironment.Production
);
Streamusing var stream = File.OpenRead("nfse.xml");
DanfeResult result = danfe.Generate(
stream,
DanfeEnvironment.RestrictedProduction
);
Em vez de bool isProd, a biblioteca utiliza:
DanfeEnvironment.Production
DanfeEnvironment.Restricted
Isso melhora legibilidade, evita erros e facilita evolução futura.
O template HTML padrão está em:
src/Danfe/Assets/Templates/Danfe.html
Você pode:
DanfeOptions.TemplatePathA biblioteca gera warnings sempre que:
"-", 0,00, string.Empty)Códigos de warning padronizados:
NFSE_FIELD_MISSINGMUNICIPIO_NOT_FOUNDTEMPLATE_PLACEHOLDER_EMPTYO projeto utiliza golden tests para evitar regressões visuais:
Para rodar os testes:
dotnet test
dotnet restore
dotnet build -c Release
dotnet test -c Release
dotnet format
npm run format
Contribuições são muito bem-vindas, especialmente para:
Veja .
MIT. Veja .
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.12.2 | 172 | 4/29/2026 |
| 1.0.12.1 | 104 | 4/29/2026 |
| 1.0.12 | 111 | 4/28/2026 |
| 1.0.11 | 122 | 3/19/2026 |
| 1.0.10 | 163 | 3/18/2026 |
| 1.0.9 | 113 | 3/18/2026 |
| 1.0.8 | 112 | 3/18/2026 |
| 1.0.7 | 113 | 3/18/2026 |
| 1.0.6 | 154 | 3/2/2026 |
| 1.0.5.1 | 126 | 2/24/2026 |
| 1.0.5 | 113 | 2/24/2026 |
| 1.0.4 | 116 | 2/24/2026 |
| 1.0.3 | 254 | 1/22/2026 |
| 1.0.2 | 118 | 1/22/2026 |
| 1.0.1 | 128 | 1/19/2026 |