As per below link, I followed to call local hosted Website for converting content to PDF, but it failed. I am using Visual studio 2012, .NET 4.5 and added aspose through NuGet. I believe, the version is the latest one.
and throwing error
Input stream for html data must be FileStream
Below is the code I used.
WebRequest request = WebRequest.Create(“[http://localhost](http://localhost/):XXXXX/WebSite1/XXX.html”);
// If required by the server, set the credentials.
request.Credentials = CredentialCache.DefaultCredentials;
// Get the response.
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
// Get the stream containing content returned by the server.
Stream dataStream = response.GetResponseStream();
// Open the stream using a StreamReader for easy access.
StreamReader reader = new StreamReader(dataStream);
// Read the content.
string responseFromServer = reader.ReadToEnd();
reader.Close();
dataStream.Close();
response.Close();
MemoryStream stream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(responseFromServer));
HtmlLoadOptions options = new HtmlLoadOptions(“[http://localhost](http://localhost/):XXXX/WebSite1/XXX.html/”);
//options…ExternalResourcesCredentials = CredentialCache.DefaultCredentials;
// load HTML file
Document pdfDocument = new Document(stream, options);
// save resultant file
pdfDocument.Save(“XXXXXXX/resultant.pdf”);