Print the MVC page as a pdf plug-in Rotativa and mvcpdf plug-in rotativa

Source: Internet
Author: User

Print the MVC page as a pdf plug-in Rotativa and mvcpdf plug-in rotativa

Recently, for a project, you need to print the user information page as pdf and export it. A plug-in was found on github, which is very useful.

Rotativa is an open-source dll encapsulation library for generating PDF documents on the user MVC page. We can find and install it in manage Nuget packages.

After installation, you can directly enter a view and generate a pdf file to return. The Code is as follows:

  

1 return new Rotativa.ActionAsPdf("UserInfo", new { id = id }) { FileName = "User.pdf" };
View Code

Rotativa. ActionAsPdf contains several overloaded constructors:

// Input an action name public ActionAsPdf (string action); // input the action name and the parameter public ActionAsPdf (string action, RouteValueDictionary routeValues) received by the key-value pair in the format of this action ); // input the action name and the object format parameter public ActionAsPdf (string action, object routeValues );

When the constructor instantiates the Rotativa. ActionAsPdf class, you can set some pdf generation information, such as FileName (pdf file name), UserName (adult), and Password.

  

  

Wkhtmltopdf 0.9.6 manuals: http://translate.baiducontent.com/transpage? Cb = translateCallback & ie = utf8 & source = url & query = http % 3A % 2F % 2Fmadalgo. au. dk % 2F ~ Jakobt%2fwkhtmltoxdoc%2fwkhtmltopdf9.9-doc.html & from = en & to = zh & token = & monLang = zh

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.