How to generate a PDF from a view using media=print for styles

Posted by Riderman de Sousa Barbosa on Stack Overflow See other posts from Stack Overflow or by Riderman de Sousa Barbosa
Published on 2012-10-22T16:58:42Z Indexed on 2012/10/22 17:00 UTC
Read the original article Hit count: 270

Most of the questions in stackoverflow or in other forums, show how to generate views and sends them by email.

But my goal is to generate a PDF from a view with the media=print format and sends it in attachment by email.

I have a view that displays a report. I use CSS Print to display this report in a print format. (Basically I display some elements and hide others).

How can I generate a PDF from this view (with format media=print) and send it by e-mail in attachment.

I am using ActionMailer to send emails and iTextSharp to generate PDFs

© Stack Overflow or respective owner

Related posts about Razor

Related posts about asp.net-mvc-4