3

I have an MVC app that is using this code:

return new Rotativa.ViewAsPdf("EmployeePrintPDF", GetModelForView(fileName))
                    {
                        CustomSwitches = "--page-offset 0 --footer-center [page] --footer-font-size 8"
                    };

The method GetModelForView(fileName) correctly returns a model of all the records needed, but when Rotativa tries to create the PDF it hangs if the model returns more than 53 records which equates to 11 pages.

I also tried to just write the PDF to a file on the server using this:

var tempPDf = new ActionAsPdf("PrintEmployeesBySearchResults", new { id = fileName })


{
                FileName = pdfPath,
                CustomSwitches = "--page-offset 0 --footer-center [page] --footer-font-size 8"
            };

            byte[] byteArray = tempPDf.BuildPdf(this.ControllerContext);

            var fileStream = new FileStream(pdfPath, FileMode.Create, FileAccess.Write);
            fileStream.Write(byteArray, 0, byteArray.Length);
            fileStream.Close();

I have also tried grabbing different sets of the records but it still hangs at more than 53 no matter which records I add to the model. Any ideas?

D Kyle
  • 41
  • 2

0 Answers0