1
I want to generate a. pdf file using Rotary, my ajax call is as follows:
$.ajax({
type: "POST",
url: "Home/Index",
data: { nome: inputName, laudos: laudos, imagem: imgSelecionada },
});
And the code in Action is this:
[HttpPost]
public ActionResult Index(UsuarioViewModel user)
{
string header = Server.MapPath("~/Views/Home/Header2.html");
string footer = Server.MapPath("~/Views/Home/Footer.html");
string customSwitches = string.Format("--header-html \"{0}\" " +
"--header-spacing \"0\" " +
"--footer-html \"{1}\" " +
"--footer-spacing \"5\" ", header, footer);
var pdf = new ViewAsPdf
{
ViewName = "Modelo",
Model = user,
CustomSwitches = customSwitches
};
return pdf;
}
Is it really possible to do something like this or should I use another approach? After a lot of research, I saw in some places that the Rotary does not work very well with ajax requests.