Read Pdf Object From S3
I am trying to create a lambda function that will access a pdf form uploaded to s3 and strip out the data entered into the form and send it elsewhere. I am able to do this when I c
Solution 1:
Solved:
This does the trick:
import boto3
fromPyPDF2 importPdfFileReaderfrom io importBytesIO
bucket_name ="pdf-forms-bucket"
item_name = "form.pdf"
s3 = boto3.resource('s3')
obj = s3.Object(bucket_name, item_name)
fs = obj.get()['Body'].read()
pdf = PdfFileReader(BytesIO(fs))
data = pdf.getFormTextFields()
Post a Comment for "Read Pdf Object From S3"