I am trying to convert a URL to PDF and have setup the following code:
Code: C#
var doc = new PdfDocument();
HtmlToPdf.Options.PageSize = PdfPageSizes.A4;
HtmlToPdf.Options.OutputArea = new RectangleF(1f, 0.2f, 7.5f, 10.8f);
string strURLPDF = "http://www.google.com";
HtmlToPdfResult result = HtmlToPdf.ConvertUrl(strURLPDF, doc);
HttpResponse response = HttpContext.Current.Response;
response.Clear();
response.ClearHeaders();
response.ContentType = "application/pdf";
doc.Save(response.OutputStream);
response.End();
But I get this error:
0x800a139e - Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 12002
or when I debug through and look at the Response I can see this:
ClientDisconnectedToken = 'HttpContext.Current.Response.ClientDisconnectedToken' threw an exception of type 'System.PlatformNotSupportedException'
I have this working on another application, and I can't work out why this would not work with this. I am using Visual Studio 2012 would this cause it to fail?
Thanks