We have implemented Rotativa to generate and save a PDF version of our web page on the server. Below is the ASP.NET MVC 4 code snippet used for this purpose:
var pdfResult = new ActionAsPdf("Index", new { orderId = orderValidated.orderID }) { FileName = filePath };
var binary = pdfResult.BuildPdf(ControllerContext);
// The file is saved only if it does not exist already, in order to preserve the original print.
if (System.IO.File.Exists(filePath) == false)
{
System.IO.File.WriteAllBytes(filePath, binary);
}
We specify a specific 'css' file for printing within the <head>
section of the page:
<head>
<link media=all href="/Content/invoice.css" type=text/css rel=stylesheet>
<link media=print href="/Content/printInv.css" type=text/css rel=stylesheet>
</head>
The 'css' file for print includes:
#logo {background: url(/assets/images/logo-plain.gif) no-repeat; height: 56px}
However, the *.gif image is missing from the generated PDF document, even though it appears correctly on the screen.
Any insights into why this might be happening?
Thank you.