title: Converting StreamReader back to pdf
body: <p>I am trying to convert pdf stream back to pdf file, then save it on my server.
  The function GetHTTPRequest gets pdf url and returns the pdf url stream string.
  I need to convert this stream to pdf file.
  My Code:</p>
  
  <pre><code>  public ActionResult Html(string strUrl) 
      {
          string xhr;
          xhr = GetHTTPRequest(strUrl, "GET");
          // make pdf file fron xhr
          return View("Index");
  
      }
  
      [ChildActionOnly]
      public static string GetHTTPRequest(string RequestUrl, string RequestMethod)
      {
          try
          {
              HttpWebRequest r = (HttpWebRequest)WebRequest.Create(RequestUrl);
              r.Method = RequestMethod;
              HttpWebResponse res = (HttpWebResponse)r.GetResponse();
              Stream sr = res.GetResponseStream();
              StreamReader sre = new StreamReader(sr);
  
              string s = sre.ReadToEnd();
  
              return s;
          }
          catch (Exception)
          {
  
              return string.Empty;
          }
      }
  </code></pre>
  
  <p>This is only 1 line from what xhr contains:</p>
  
  <p>"%PDF-1.3\n%�쏢\n5 0 obj\n&lt;>\nstream\nx��\k���V �DB��rq��\r}��_�4U[��\nTҮ<em>U�~�ِBI h����>gl����n�N���Y{.�~�33�;�h����뷶.��W7�n����ͭ;[������[կ��?TR��T�_l�6� �O�e�ll��\m\b�����T����F�����V��n���6h嫍��Hk��l�R��O6ô3�7O5�:�.�i&lt;�:���3��S�j��V�O��\b�~&amp;\r�S93�l�ѭ�Q�z�v�cF</em>)���\r��g��m�v����Z���<em>\a���;{�i��Bq�7��^xK�7�U��P?��z>����]���F\b1�X�ec��/4�ji��/К��&amp;#�EjF)�g�D�\v)��_ �\r|��XSEcu�\nILz��H|�ZL�a�wO\af^m6�NzS_lb$�Vx\rB�VG��_���44�v���������w������4J����Q�z���7</em>�刭��+�a�|�7�Z����&amp;��ٕQ��LsE��c�t뜁������)�ad���ӷ2��inSU��-��\a��\fā4ʹ�v1�w�ֽ����)�����S0�����2M�~�S�;�Ԩ2�\a|�����'K�0[\"{��F��<em>5��2�ٱJ[��ӑ ��F�����3��X�s'\b9�[�&amp;�Et��A\"�����N���������)7=�p�T�v.�!�q\"��H����M-i�,��TA��P����tV{]V=z����\rV����T��o</em>�c�s�������[w*i�g��R�EZ�Λ.JQ}�\r:�w)�Ȕڣ�����{�)e%�(GF3�H8�G�Ԣ5)G^u�C�F�ÂQ\v�A=I\"�G\"�@�i�X�3d�����P;%=r���8@\he&lt;�IAv��\a������D[ؕ]���7X��!��\b@B�Y$a5\bÂ \b��T�.���Կ,\n�)1�V�\0N�z�$Pȡ����%</p>
  
  <p>Can someone please put some light on it and solve it for me?
  I never used stream libary before.</p>
  
  <p>Thanks.</p>