I want to export my current HTML page after(ng-view is rendered) to a pdf. I am using EvoPDF software to do that but when I am trying to export it the HTML inside ng-view is not coming in the pdf as it. The PDF just contains the header as the header is static element and ng-view is being constructed from XmlHttpRequest.
I tried giving pdfConverter.ConversionDelay = 10; thinking that because of loading time of XmlhttpRequest it is not rendering but still no luck.
I am using HttpModule in .net as backend.
public void ProcessRequest(HttpContext context)
{
if (context.Request.UrlReferrer != null)
{
try
{
HtmlToPdfConverter pdfConverter = new HtmlToPdfConverter();
pdfConverter.ConversionDelay = 10;
byte[] outPdfBuffer = pdfConverter.ConvertUrl(context.Request.UrlReferrer.ToString());
context.Response.AddHeader("Content-Type", "application/pdf");
// Instruct the browser to open the PDF file as an attachment or inline
context.Response.AddHeader("Content-Disposition", String.Format("{0}; filename=report.pdf; size={1}",
"attachment", outPdfBuffer.Length.ToString()));
context.Response.BinaryWrite(outPdfBuffer);
// End the HTTP response and stop the current page processing
context.Response.End();
}
}
}
Can you please let me know how to fix this.
Thanks. Sajesh nambiar
There was no problem, it was a CORS issue on my local system thats why the call to fetch the data was failing, everything is working now.
Regards, Sajesh