title: Python:Conversion of PDF to blob and back to pdf leads to corrupt
body: <p>I am testing one of the scenarios for my nosql-database setup where I am storing blobs of PDF data. Later, want to use if it can retrieve the original pdf document. Just to test it, I wrote a small test code in Python. </p>
  
  <pre><code>import base64
  with open('test.pdf', 'rb') as f:
   blob = base64.b64encode(f.read())
  
  text_file = open('test_blob.txt', "w")
  text_file.write(blob)
  text_file.close()   
  
  with open('test_blob.txt', 'r') as f:
    blob=f.read().decode('base64')
  text_file = open('result.pdf', "w")
  text_file.write(blob)
  text_file.close()
  </code></pre>
  
  <p>When I checked to see the result.pdf, it was corrupt. What could be the problem?</p>