Skip to content

pixelia-es/RazorPDF2

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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. 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 died 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. There is a short screencast on my blog to get you started so well as a sample project and some syntax samples.

##Acknowledgements RazorPDF likely wouldn't exist without the Spark view engine. The ability to create PDFs with the Spark view engine is something I've missed often since switching to using Razor as my default view engine in MVC projects. Huge thanks to Louis DeJardin for putting together the Spark view engine many years ago and for the idea of mixing Spark with iTextSharp as a nice way to make PDFs.

Also, RazorPDF is worthless without iTextSharp. Thanks so much to the team that works on that incredible project.

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.7%
  • Other 0.3%