Git Product home page Git Product logo

Comments (7)

yosefvb avatar yosefvb commented on June 4, 2024 1

Thanks @darwaishx ! It would be great to add this to the READ.me to clarify to future users.

from amazon-textract-textractor.

darwaishx avatar darwaishx commented on June 4, 2024

Textract async API expect PDF as an S3 object.

Example below show how to take a PDF on local disk, extract individual images and process them.
https://github.com/aws-samples/amazon-textract-searchable-pdf/blob/master/src/SearchablePDF/src/main/java/DemoPdfFromLocalPdf.java

from amazon-textract-textractor.

ocelotsloth avatar ocelotsloth commented on June 4, 2024

Yeah @darwaishx that README is pretty confusing...at least it got me on this same issue as well.

There are a couple sections in particular:

  • python3 textractor.py --documents [file|folder|S3Object|S3Folder] --text --forms --tables --region [AWSRegion] --insights --medical-insights --translate [LanguageCode]
Argument Description
--documents Name of the document or local folder/S3 bucket

which seem to reference (or at least mistakenly imply) the ability for this script to accept local files directly.

from amazon-textract-textractor.

jostradamus avatar jostradamus commented on June 4, 2024

Probably clarify more between 'documents' and 'pdf'.

Beautifully written samples and textractor local tools

from amazon-textract-textractor.

grantrosse avatar grantrosse commented on June 4, 2024

Ran into this as well, send the PDF as bytes instead:

file_name = 'Invoice_INV300351.pdf'
client = boto3.client('textract', 'us-east-1')
with open(file_name, "rb") as sample_file:
    b = bytearray(sample_file.read())
response = call_textract(input_document=b, boto3_textract_client=client )
pickle.dump(response, open(f'response_{file_name.split(".")[0]}.pk', 'wb')) 

from amazon-textract-textractor.

schadem avatar schadem commented on June 4, 2024

Thx @grantrosse , can you create a new ticket? In 2019 (original ticket date), Textract did in deed not support a PDF to be passed in from the local filesystem. However, that changed now and we should update that behavior.

from amazon-textract-textractor.

grantrosse avatar grantrosse commented on June 4, 2024

Yeah for sure @schadem #236

from amazon-textract-textractor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.