I am trying to remove the navbar and print button from the page that I am trying to print. I attempted to use CustomSwitches but Rotativa does not appear to like them.
string customSwitches =
"--disable-smart-shrinking --header-html {0} --footer-html {1}";
var printForm = new ActionAsPdf("Receipt", new { id = id })
{
PageSize = Rotativa.Options.Size.Legal,
CustomSwitches = customSwitches
};
return printForm;
My view for reference: Print view.
What are some thoughts?
--print-media-type
custom switch.no-print
for your navbar div and buttonThen write your CSS like this
@media print
{
.no-print, .no-print *
{
display: none !important;
}
}