title: Convert hex string to pdf
body: <p>I have a string like <code>0x255044462D312E330D0A312030206F626A0D0</code> and I've tried to convert it to a <code>PDF</code>.</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>var inputStr="my hex string";
  pdfFile = Encoding.Unicode.GetBytes(inputStr).ToArray();
  return new FileContentResult(pdfFile, "application/pdf");
  </code></pre>
  
  <p>It's not working ( "Failed to load PDF document" is the message I get ). What am I doing wrong? I've also tried to change <code>response</code>:</p>
  
  <pre><code>Response.ClearHeaders();
  Response.Clear();
  Response.AddHeader("Content-Type", "application/pdf");
  Response.AddHeader("Content-Length", pdfFile.Length.ToString());
  Response.AddHeader("Content-Disposition", "inline; filename=sample.pdf");
  Response.BinaryWrite(pdfFile);
  Response.Flush();
  Response.End();
  </code></pre>
  
  <p><strong>Update</strong></p>
  
  <p>I don't know how the string was initially encoded</p>
  
  <p><strong>Update 2</strong></p>
  
  <p>So I'm receiving "-2" because of someone who thought this questions is a duplicate ( he deteled his answer by the way ) ? Thank you</p>