
Security News
Risky Biz Podcast: Making Reachability Analysis Work in Real-World Codebases
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
github.com/marcelo-cunha/nfce-render
Biblioteca Go para geração de DANFE (Documento Auxiliar da Nota Fiscal Eletrônica) para NFC-e (Nota Fiscal de Consumidor Eletrônica).
go get github.com/marcelo-cunha/nfce-render
package main
import (
"fmt"
"os"
nfce "github.com/marcelo-cunha/nfce-render"
)
func main() {
// Ler XML da NFC-e
xmlContent, err := os.ReadFile("nfce.xml")
if err != nil {
panic(err)
}
// Gerar DANFE em HTML
options := &nfce.Options{Format: "html"}
danfeBytes, err := nfce.GenerateDANFE(xmlContent, options)
if err != nil {
panic(err)
}
// Salvar arquivo
err = os.WriteFile("danfe.html", danfeBytes, 0644)
if err != nil {
panic(err)
}
fmt.Println("DANFE gerado com sucesso!")
}
// Gerar DANFE a partir de conteúdo XML
danfeBytes, err := nfce.GenerateDANFE(xmlContent, options)
// Gerar DANFE a partir de arquivo XML
danfeBytes, err := nfce.GenerateDANFEFromFile("nfce.xml", options)
// Salvar DANFE diretamente em arquivo
err := nfce.SaveDANFE(xmlContent, "danfe.html", options)
// Salvar de arquivo XML para arquivo de saída
err := nfce.SaveDANFEFromFile("nfce.xml", "danfe.html", options)
// Escrever para io.Writer
err := nfce.WriteDANFE(xmlContent, writer, options)
type Options struct {
Format string // "html" ou "pdf"
}
// Criar gerador
generator, err := nfce.NewGenerator(xmlContent)
// Verificar se é NFC-e
if generator.IsNFCe() {
// Gerar para writer específico
options := nfce.GenerateOptions{Format: nfce.FormatHTML}
err = generator.GenerateToWriter(writer, options)
}
Para geração de PDF, configure a variável de ambiente:
export GOTENBERG_URL="http://localhost:3000"
Ou use o arquivo .env
:
GOTENBERG_URL=http://localhost:3000
Este projeto está licenciado sob a Licença MIT - veja o arquivo LICENSE para detalhes.
Versão estável: v1.0.0
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.