I found Rotativa as an easy way to export to PDF (works almost perfectly except CSS3 doesn't seem to be supported, maybe in a future version) ... but I wonder how to handle the FileName
option.
When I
return new Rotativa.ViewAsPdf("myViewName", "~/Views/Shared/_PDFLayout.cshtml", myModel)
{
FileName = "myCorrectlyNamed.pdf",
PageSize = ... // plus some more options
};
then I'll get myCorrectlyNamed.pdf
for download. When I omit the FileName
option, the PDF is displayed in the browser, but when I save it from there, it has just the default filename document.pdf
.
How to generate and display the pdf in the browser and have a filename other than document.pdf
when it's saved from there?