title: How can i read file pdf in AWS S3 with boto3 in python?
body: <p>I would like to read .pdf files in S3 bucket, but the problem is that it returns formatted bytes,
  Whereas if the file is in .csv or .txt this code works
  What's wrong with .pdf files?</p>
  <p>the code :</p>
  <pre><code>import boto3
  s3client = boto3.client('s3') 
  fileobj = s3client.get_object(
      Bucket=BUCKET_NAME,
      Key='file.pdf'
      ) 
  filedata = fileobj['Body'].read()
  contents = filedata
  print(contents)
  </code></pre>
  <p>it returns :</p>
  <pre><code>b'%PDF-1.4\n%\xd3\xeb\xe9\xe1\n1 0 obj\n&lt;&lt;/Title (Architecture technique)\n/Producer (Skia/PDF m99 Google Docs Renderer)&gt;&gt;\nendobj\n3 0 obj\n&lt;&lt;/ca 1\n/BM /Normal&gt;&gt;\nendobj\n6 0 obj\n&lt;&lt;/Type /XObject\n/Subtype /Image\n/Width 1424\n/Height 500\n/ColorSpace /DeviceRGB\n/SMask 7 0 R\n/BitsPerComponent 8\n/Filter /FlateDecode\n/Length 26885&gt;&gt; stream\nx\x9c\xed\xdd\xeb\x93$Y\x99\xe7\xf7'
  </code></pre>
  <p>another solution that i try but not work too:</p>
  <pre><code>import boto3
  from PyPDF2 import PdfFileReader
  from io import BytesIO
  
  s3 = boto3.resource('s3')
  obj = s3.Object(BUCKET_NAME,'file.pdf')
  fs = obj.get()['Body'].read()
  pdfFile = PdfFileReader(BytesIO(fs))
  </code></pre>
  <p>it's return :</p>
  <pre><code>&lt;PyPDF2.pdf.PdfFileReader at 0x7efbc8aead00&gt;
  </code></pre>