Reports with Asp.Net MVC

Asked

Viewed 2,691 times

8

Hello, I would like to know some options of reports with Asp.Net MVC.

I tried to use Reportviewer but it gets typed with the bank and not to use with objects.

Would anyone have any suggestions?

Thank you.

4 answers

9

  • 1

    I didn’t know the Rotary, the same is already Favorite.

4

A library I use is selectpdf, which makes it possible to generate pdf reports from html documents with css styling, making it much easier to format the generated report.

It has extensive documentation that can be found on its own http://selectpdf.com/pdf-library-for-net/, and also you can use it with its free version or its commercial version, the free version instead with some limitations, but itself can do a lot with it.

Example:

// create a new pdf document
PdfDocument doc = new PdfDocument();

// add a new page to the document
PdfPage page = doc.AddPage();

// create a new pdf font
PdfFont font = doc.AddFont(PdfStandardFont.Helvetica);
font.Size = 20;

// create a new text element and add it to the page
PdfTextElement text = new PdfTextElement(50, 50, "Hello world!", font);
page.Add(text);

// save pdf document
doc.Save(Response, false, "Sample.pdf");

// close pdf document
doc.Close();

Using it, a problem you may have and when rendering html page with some model, and to solve this problem you can use the Razorengine library.

Example:

string template = "Hello @Model.Name! Welcome to Razor!";
string result = Razor.Parse(template, new { Name = "World" });
  • 1

    Price salty eim...even more with the dollar on the rise

  • Yes, it really is a little expensive, but in itself taking its limitations using its free version, give to do a lot of things with it.

4

2


Thank you all for the good suggestions I received, but I ended up choosing to generate the reports in HTML and I am using Mvcrazortopdf to generate the pdfs.

Project link on Github: https://github.com/andyhutch77/MvcRazorToPdf

Browser other questions tagged

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