Skip to content

Simple project for making PDFs from Razor views in ASP.NET MVC

License

Notifications You must be signed in to change notification settings

lucciu5/RazorPDF2

 
 

Repository files navigation

RazorPDF2

RazorPDF is a simple project that makes it a breeze to create PDFs using the Razor view engine. Since Razor is really a template syntax, it can do lot more than just generate HTML. RazorPDF uses it to generate iText XML older notation. Then using the iTextSharp library, we turn that iText XML into a PDF to return. The end result is a easy to use, clean method for generating PDFs.

This project is a continuation from original Al Nyveldt's project. Apparently the guy "took a break" since 2013 and all the pull request made in the original repository (some of them made by me) were unanswered. This encouraged me to fork his repository and make the changes by myself, but is not simple as it seemed before.

Bruno Lowagie, the creator of iTextSharp, RazorPDF's dependent library, said in this answer that the older syntax, supported by RazorPDF, should be discouraged, arguing that the older syntax can cause a lot of bugs, etc., what left me with no options: I need to ensure compatibility with legacy systems and extend compatibility to iTextSharp 5.x.x without reimplement lots of ready and working templates. I respect Lowagie's decision to abandon an old template, but this is not a good decision for legacy systems, essentially when the library involved is a popular framework.

What I did in this project is to blend RazorPDF, iTextSharp 4.1.6 and MvcRazorToPdf. I admit it's not the optimal solution, but at least works with all your project packages updated and without crashing anything.

Usage

The easiest way to get started with RazorPDF is to add the NuGet package to your MVC project:

Install-Package RazorPDF2

There is a short screencast on Nyveldt's blog to get you started so well as a sample project and some syntax samples.

License

RazorPDF2 is licensed under MIT License.

About

Simple project for making PDFs from Razor views in ASP.NET MVC

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 99.6%
  • Other 0.4%