Recently done project, need to print the user Information page as a PDF export, on GitHub found a plug-in, very useful.
Rotativa is an open source user MVC page that generates a DLL wrapper library for PDF documents, and we can find and install it in the Manage NuGet package.
Once installed, you can enter a view directly and generate a PDF to return it, specifically the code:
1 return New Rotativa.actionaspdf ("UserInfo"new"user.pdf" };
View Code
The rotativa.actionaspdf contains several overloaded constructors:
// Pass in an action name Public Actionaspdf (string action); // incoming action name, and key-value pair format for this action received parameter Public Actionaspdf (string// incoming action name, and parameter public in object Format ) Actionaspdf (stringobject routevalues);
When the constructor instantiates the Rotativa.actionaspdf class, it can set up some PDF generation information, such as filename (PDF file name), UserName (generated person), Password (password), and so on.
Wkhtmltopdf 0.9.6 Handbook: Http://translate.baiducontent.com/transpage?cb=translateCallback&ie=utf8&source=url &query=http%3a%2f%2fmadalgo.au.dk%2f~jakobt%2fwkhtmltoxdoc%2fwkhtmltopdf-0.9.9-doc.html&from=en&to =zh&token=&monlang=zh
The MVC page is printed as a PDF plugin Rotativa