Create pdf documents within an asp .net mvc project by generating your views as normal but returning a PdfActionResult. This converts regular produced razor/html to pdf documents in the browser using the iTextXmlWorker.
I get the following error when I call GeneratePdf:
RuntimeWorkerException was unhandled by user code
An exception of type 'iTextSharp.tool.xml.exceptions.RuntimeWorkerException' occurred in itextsharp.xmlworker.dll but was not handled in user code
Additional information: Invalid nested tag head found, expected closing tag link.
This is the call:
byte[] pdfOutput = ControllerContext.GeneratePdf(model, "CreatePDF", (writer, document) => {
document.SetPageSize(PageSize.LETTER);
document.NewPage();
});
I get the following error when I call GeneratePdf: RuntimeWorkerException was unhandled by user code An exception of type 'iTextSharp.tool.xml.exceptions.RuntimeWorkerException' occurred in itextsharp.xmlworker.dll but was not handled in user code Additional information: Invalid nested tag head found, expected closing tag link.
This is the call: byte[] pdfOutput = ControllerContext.GeneratePdf(model, "CreatePDF", (writer, document) => { document.SetPageSize(PageSize.LETTER); document.NewPage(); });
Roy W Bradley
I've attached the view http://localhost:57108/Views/PDF/CreatePDF.cshtml