Reputation: 426
i have some trouble to get the header AND the footer at the same time in the generated PDF in rotativa asp.net core .
here my controller code :
string customSwitches = string.Format(" --header-html {0} --footer-html {1} ",
Url.Action("PDFHeader", "PDF", new { vinum = VINUM, YEAR="2018" }, "https") ,
Url.Action("PDFFooter", "PDF", new { }, "https"));
return new ViewAsPdf(res)
{
PageSize = Size.A4,
PageOrientation = Orientation.Portrait,
CustomSwitches = customSwitches ,
PageMargins = { Left = 20, Bottom = 20, Right = 20, Top = 20 }
};
if i remove the footer the header show correctly . if i remove the header the footer show correctly .
as you can see the header and footer are dynamically generated .
any idea on what's going on ?
Rotativa version : 1.0.6
wkhtmltopdf version : 0.12.5 (with patched qt)
thanks .
Upvotes: 0
Views: 2314
Reputation: 426
after lot of troubles, this what worked for me :
string customSwitches = string.Format("--header-spacing \"0\" --footer-spacing \"0\" --header-html {0} --footer-html {1} ",
Url.Action("PDFHeader", "PDF", new { vinum = VINUM, YEAR="2018" }, "https") ,
Url.Action("PDFFooter", "PDF", new { }, "https"));
return new ViewAsPdf(res)
{
PageSize = Size.A4,
PageOrientation = Orientation.Portrait ,
CustomSwitches = customSwitches ,
PageMargins = { Left = 10, Bottom = 33, Right = 10, Top = 50 }
};
it's all about spacing wierd parameters:)
Upvotes: 1