I'm trying to learn how to make a View converted into PDF format so it can be printed or downloaded by a user.
I read some posts and decided to follow the indication of a library called Revolving that seemed very simple to use.
It actually generated a PDF, but the generated PDF came with my Application Login page, rather than the View that was passed to Action.
I think it has something to do with access rights. I tried to put a [AllowAnonymous] on the Action but that did not change the result.
The controller code is simple and has been done following the directions of the Rotary page:
[AllowAnonymous]
public ActionResult CriarRelatorioEmPDF(FiltroDeTarefaHorasViewModel model)
{
model = CarregarModelo(model);
return new ActionAsPdf("RelatorioEmPDF", model ) { FileName = "RelatorioDeHoras.pdf" };
}
public ActionResult RelatorioEmPDF(FiltroDeTarefaHorasViewModel model)
{
return View(model);
}
Any idea of what might be happening and how to solve it?
Thank you in advance.