1

I have a MVC website that process transactions, and then renders a page with the transaction information as an invoice.

And i have an option to print the page as the receipt.

The invoice is nicely styled with bootstrap and more custom styles,

I was asked to make an option to email the invoice to the email on the transaction

now my question is, if there is a way to render the page on the server as a PDF, and email it without returning the page to the client,

Also if its possible, i will need to make the PDF with the print CSS styles applied, because there is a lot of stuff that is hidden on the page at print.

CMS
  • 3,657
  • 1
  • 27
  • 46
  • 1
    Those are two questions. Try to search. – CodeCaster Jul 08 '15 at 22:07
  • possible duplicate of [How to render an ASP.NET MVC View in PDF format](http://stackoverflow.com/questions/1324597/how-to-render-an-asp-net-mvc-view-in-pdf-format) – CodeCaster Jul 08 '15 at 22:08
  • I have been in PDF from HTML creation problems several times, seen all nuget packages that render HTML to PDF and they all suck. What i did after all is generated word file and then virtually scanned it to pdf. Not ideal as you baically get pictures of pages, and size may or may not be an issue, but it looks exactly the same as in word, tables, decorations, everything. Good luck :) – Mladen Oršolić Jul 08 '15 at 22:11

1 Answers1

0

I use Rotativa which convert razor view to pdf and keeps the css styles and layouts.

It works very well for me.

https://github.com/webgio/Rotativa

The nuget link is as below. Looks like a lot people are using it.

https://www.nuget.org/packages/Rotativa

Yang Zhang
  • 4,540
  • 4
  • 37
  • 34