i want to create PDF file by URL using ASPOSE.PDF and try the following code:
string dataDir =@"C:\Users\UbaidUllah\Documents\Visual Studio 2015\Projects\aspose\Data\AsposePDF\DocumentConversion\"; WebRequest request = WebRequest.Create("https://www.cricbuzz.com/cricket-stats/icc-rankings/men/batting"); request.Credentials = CredentialCache.DefaultCredentials; HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream dataStream = response.GetResponseStream(); StreamReader reader = new StreamReader(dataStream); string responseFromServer = reader.ReadToEnd(); reader.Close(); dataStream.Close(); response.Close(); MemoryStream stream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(responseFromServer)); HtmlLoadOptions options = new HtmlLoadOptions("https://www.cricbuzz.com/"); Document pdfDocument = new Document(stream, options);//----not execute this line nor give any error----- pdfDocument.Save(dataDir + "WebPageToPDF_out.pdf");
when i debug this code, it does not go forward from the second last line(as described in comment) nor give any error, i wait much time but do not get any response.
I don’t know where the mistake is. please review the code and help me to solve the issue.
please also share the links by wich same task could be done by ther techniques:)
Thank you very much!