Click here to Skip to main content
15,890,185 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have MVC Razor View with Bootstrap CSS + Custom CSS applied on it & many data like Logo(in image format), Header, Footer etc.
How can I Export MVC Razor View to pdf without iTextSharp / RazorPdf in MVC?
Let me know suggestion. The pdf should look like same as a View.
Posted

If you don't want to use any third-party tools then you'll need to learn the PDF format and how to create PDF documents yourself. .net has no in-built for PDF as it is a proprietary format so you're going to have to use some form of third party tool or do it yourself.
 
Share this answer
 
HTML5 and PDF have two different view on the concept of "document". Please note, that PDF is based on PostScript, which is a complex programmable descriptive language for printers. The web for which html5, css3 and other things bootstrap relies on are living in a totally different world.
So mapping some content and format between html and pdf is a matter of convention you have to decide, and eventually implement. The tools you have referred to or MvcRazorToPdf[^] are doing this in their own way. Either way, they read the html content, interprete the format and generate pdf primitives. Bootstrap is to complex, too dynamci and too new to have a ready-made mapper to use. So you either do it yourself, or accept the constraits of the existing tools.

You shoudl read these too:
http://daveaglick.com/posts/using-aspnet-mvc-and-razor-to-generate-pdf-files[^]
Generate PDF in ASP.NET MVC Using Rotativa[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900