You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BrianMinister edited this page Sep 4, 2014
·
1 revision
Rotativa wiki!
How to set properties for the ViewAsPDF function.
/* * So you know what filename is. */stringfilename="SomeFileName.pdf";/* * So you know what inData is. */List<string>inData=newList<string>//Can be any marshalable object./* * This is all inline, but you can create the view as an anonymous type, * then populate its properties, then return it. */
return new ViewAsPdf("MyCSHtmlView",inData){FileName=filename,PageOrientation=Rotativa.Options.Orientation.Portrait,IsGrayScale=true,IsJavaScriptDisabled=true,IsBackgroundDisabled=true,MinimumFontSize=12,PageSize=Rotativa.Options.Size.Letter,PageMargins=newRotativa.Options.Margins(15,10,15,10),CustomSwitches=string.Format("--footer-left \"File Name: {0}\" "+"--footer-right \"Page [page] of [toPage]\" "+"--footer-font-size \"8\" "+"--footer-line "+"--footer-spacing \"3\"",filename)};