2
Reply

Saving stream as a PDF file to disk

walid mousbah

walid mousbah

Jun 24 2015 6:20 PM
439
Hi,
This example retrieves a pdf document.  
How can I save the data as a pdf file to disk?
Thanks

string jsonResponse ;
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(string uri);
webRequest.Method = "GET";
webRequest.Accept = "application/pdf";

using (HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse())
{
  using (StreamReader reader = new StreamReader(webResponse.GetResponseStream()))
  {

    jsonResponse = reader.ReadToEnd();

  }
}

Answers (2)