Generate Danfe from Nfe XML

Asked

Viewed 4,598 times

5

I’m developing an application ASP.NET MVC with C# and need to transform XML from NF-e to Danfe in PDF, someone knows some component to it?

  • Component for what? To generate the PDF? Or you want a component in which you play the XML and it mounts the Danfe?

  • I need to upload the nfe xml and generate the danfe pdf.

  • Let’s start from the beginning. Try to be as clear as possible. You can already generate and send XML, right?

  • I already have NFE XML, what I want is to pass this xml to the application and it return me the danfe in pdf already in the standards, wanted some open source component, because creating from scratch, will take a lot of work.

  • 3

    It’s really hard. I wrote mine. The good thing about using a ready-made one is... it’s ready :) problem of using a ready-made one is that every time you change something, you have to root for the staff to update it, because if they don’t update it soon, hold the client in your ear :)

  • 2

    Complementing the @Bacco comment, you can use some framework on github, for example, and create a Fork for you and so you change it right there. I do this when there is no functionality I want in the framework and I don’t want to wait for the update of the original project. I change mine and then propose the change in the original design, since you also need to contribute with it.

Show 1 more comment

1 answer

3


In a simple Google search I found the Danzor, seems to do exactly what you need.

To install it, open the Package Manager Console and type

PM> Install-Package Danzor

In your controller create an instance of Danzorprintviewr passing the path where the Nfe XML is

public ActionResult Danfe()  
{
    var model = new DanzorPrintViewer("<<caminho do arquivo>>");
    return View("~/Views/Danfe/Danfe.cshtml", model);
}

Example taken from the component’s website

  • I tried that component, but it does not install here, from the following error: Install-Package : Unable to find package 'Danzor'.

  • There must be some problem with your Nuget configuration. See, the component is still available https://www.nuget.org/packages/Danzor/

  • @Henriquedpereira Join the chat if you need help with the nuget

  • Di boa could not, but download their source, I will create mine taking as base their, vlw.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.