title: Trouble Downloading PDF with WebClient
body: <p>We have a process which accesses an external API to obtain and download a PDF file.  Here is the process:</p>
  
  <pre><code>using (var client = new WebClient())
  {
      client.BaseAddress = add;
      client.Encoding = System.Text.Encoding.UTF8;
      client.Headers[HttpRequestHeader.ContentType] = "application/pdf";
      client.Headers.Add(HttpRequestHeader.Authorization, "Basic ");
      JObject jobject = generateReportPDFRequest(report.ReportID);
      //string tst = jobject.ToString();
      string result = client.UploadString(add, "POST", jobject.ToString());
      if (!string.IsNullOrEmpty(result))
      {
          retval = AddReportPDF(reportid, Encoding.ASCII.GetBytes(result));
      }
  }
  
  public static JObject generateReportPDFRequest(string reportid)
  {
      try
      {
          // create the object
          JObject jsonRequest = new JObject();
          // add version property
          jsonRequest.Add("version", "1.0");
          // add content object
          JObject content = new JObject();
          JObject repid = new JObject();
          content.Add("customer-report-id", @"" + reportid + @"");
          content.Add("content-type", "application/pdf");
          JObject reportRequest = new JObject();
          jsonRequest.Add("content", content);
          return jsonRequest;
      }
      catch (Exception e)
      {
          string mess = e.Message;
      }
      return null;
  }
  </code></pre>
  
  <p>I'm trying to get the PDF with the Encoding.ASCII.GetBytes(result) process which is return with the WebClient upload string post.  The stream is converted to a byte array and saved into the database.  But the file is empty. </p>
  
  <p>I had one person tell me that I am saving the file as version 1.6 and what is downloaded is version 1.4.  If that is the problem, how do I define the PDF version?  If not, how do I get these PDF files properly?</p>