title: Download and Save PDF for viewing
body: <p>Im trying to download a PDF document from my app and display it in IBooks or at least make it available to read some how when its completed downloading.</p>
  
  <p>I followed the download example from Xamarin which allows me download the PDF and save it locally. Its being save in the wrong encoding also.</p>
  
  <p>This is what I've tried so far.</p>
  
  
  
  <pre class="lang-cs prettyprint-override"><code>private void PdfClickHandler()
  {
      var webClient = new WebClient();
  
      webClient.DownloadStringCompleted += (s, e) =&gt; {
          var text = e.Result; // get the downloaded text
          string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
          string localFilename = $"{_blueways}.pdf";
          // writes to local storage
          File.WriteAllText(Path.Combine(documentsPath, localFilename), text); 
  
          InvokeOnMainThread(() =&gt; {
              new UIAlertView("Done", "File downloaded and saved", null, "OK", null).Show();
          });
      };
  
      var url = new Uri(_blueway.PDF);
      webClient.Encoding = Encoding.UTF8;
      webClient.DownloadStringAsync(url);
  }
  </code></pre>