title: Write PDF from binary in database
body: <p>Okay,</p>
  
  <p>I have a SQL 2005 database with a stored PDF. The column uses the image type. So when the PDF gets stores it is a byte[] array.</p>
  
  <p>So here is the hard part. I can get it to store the data but I am not sure how to go about getting the byte[] array back into PDF format and display it on the web page.</p>
  
  <p>I am using a 3rd part tool to generate the PDF, which works great. </p>
  
  <p>The code I have to generate the byte[] array is as follows:</p>
  
  <pre><code>Doc document = new Doc();
  byte[] myArray = document.GetData();
  </code></pre>
  
  <p>I then insert the byte[] array into the database.</p>
  
  <p>When I get the array back from the database I do this:</p>
  
  <pre><code>public byte[] GetPDF(parameters)
  {
      return DAL.GetPDF(parameters)
  }
  </code></pre>
  
  <p>This returns a valid byte[] array as it is supposed to.</p>
  
  <p>Now, the only issue is actually writing the PDF to the web site and having it display on the web site, I am not sure how to do this or where to even begin. </p>