RazorPDF Samples
I worked up some more advanced RazorPDF samples to help you get started with using RazorPDF in your MVC projects.
First, I went ahead and made an very simple HTML report and ran it through the PdfResult to output it as a PDF. It is nice way to make a PDF without iText XML. You can use this to easily take any view and allow the user to display it as a PDF. I think you can format your PDFs better with iText XML, but this works well in a lot of situations.
public ActionResult Something()
{
// Get model
var list = repository.GetStuff();
// Output to Pdf?
if (Request.QueryString["format"] == "pdf")
return new PdfResult(list, "Something");
return View(list);
}
Next, I made a sample report showing more detailed iText XML that you might use in actual production report. Paragraphs, images, tables and lists in different fonts, sizes, styles and colors. I added some of the most common tags in this Gist to use as a reference.
The reports mentioned are all checked in to the RazorPDF Sample project on GitHub.
I encourage you to check it out if you are planning to give RazorPDF a try.