Hi,
I am getting InvalidCastException while creating pdf doc from html of long string. for example a wikipedia article link.
(if I do this with short html string it works. you can see the working sample in commented line)
What may be the cause?
const string url = "https://tr.wikipedia.org/wiki/T%C3%BCrk%C3%A7e"; const string filePath = "test_turkish.pdf"; var license = new License(); license.SetLicense(@"C:\License\Aspose.Total.lic"); var html = string.Empty; //html = @""; var request = WebRequest.Create(url); var response = (HttpWebResponse)request.GetResponse(); var responseStream = response.GetResponseStream(); if (responseStream != null) { var reader = new StreamReader(responseStream); html = reader.ReadToEnd(); reader.Close(); responseStream.Close(); response.Close(); } var stream = new MemoryStream(Encoding.UTF8.GetBytes(html)); var options = new HtmlLoadOptions(); var pdfDocument = new Document(stream, options); pdfDocument.Save(filePath);test heading
test paragraph... test turkish chars üğşiçöıIÜĞİŞÇÖ