Rotativa.AspNetCore
Rotativa.AspNetCore copied to clipboard
SaveOnServerPath not work
ViewAsPdf
use to Save file on Server Path but not work by SaveOnServerPath Property
var pdfname = String.Format("{0}.pdf", Guid.NewGuid().ToString());
var path = Path.Combine(@"MyPathProject\wwwroot\doc\Claim\Request", pdfname);
path = Path.GetFullPath(path);
var pdfResult = new ViewAsPdf
{
ViewName = "_ToPDF",
Model = memo,
FileName = pdfname,
SaveOnServerPath = path
};
Late, but just for reference if anyone stumbles on this issue. This works:
var pdf = new ViewAsPdf()
{
SaveOnServerPath = "wwwroot/output.pdf"
};
pdf.BuildFile(this.ControllerContext);
SaveOnServerPath
is obsolete though. If you don't specify it, a byte array is returned, which you can use to save the file yourself:
var pdfFile = new ViewAsPdf().BuildFile(this.ControllerContext);
File.WriteAllBytes("wwwroot/output.pdf", pdfFile);
Added this as documentation in #92.