Skip to main content

Textract-Pipeline-PageDimensions

Provides functions to add page dimensions with doc_width and doc_height to the Textract JSON schema for the PAGE blocks under the custom attribute in the form of:

e. g.

{'PageDimension': {'doc_width': 1549.0, 'doc_height': 370.0} }

Install

> python -m pip install amazon-textract-pipeline-pagedimensions

Make sure your environment is setup with AWS credentials through configuration files or environment variables or an attached role. (https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html)

Samples

Add Page dimensions for a local file

sample uses amazon-textract-caller amazon-textract-pipeline-pagedimensions

python -m pip install amazon-textract-caller
from textractpagedimensions.t_pagedimensions import add_page_dimensions
from textractcaller.t_call import call_textract
from trp.trp2 import TDocument, TDocumentSchema

j = call_textract(input_document='<path to some image file>')
t_document: TDocument = TDocumentSchema().load(j)
add_page_dimensions(t_document=t_document, input_document=input_file)
print(t_document.pages[0].custom['PageDimension']) 
# output will be something like this:
# {
#     'doc_width': 1544,
#     'doc_height': 1065
# }

Using the Amazon Textact Helper command line tool with PageDimensions

Together with the Amazon Textract Helper and Amazon Textract Response Parser, we can build a pipeline that includes information about PageDimension and Orientation of pages as a short demonstration on the information that is added to the Textract JSON.

> python -m pip install amazon-textract-helper amazon-textract-response-parser amazon-textract-pipeline-pagedimensions
> amazon-textract --input-document "s3://amazon-textract-public-content/blogs/2-pager-different-dimensions.pdf" | amazon-textract-pipeline-pagedimensions --input-document "s3://amazon-textract-public-content/blogs/2-pager-different-dimensions.pdf"  | amazon-textract-pipeline --components add_page_orientation | jq '.Blocks[] | select(.BlockType=="PAGE") | .Custom'

{
  "PageDimension": {
    "doc_width": 1549,
    "doc_height": 370
  },
  "Orientation": 0
}
{
  "PageDimension": {
    "doc_width": 1079,
    "doc_height": 505
  },
  "Orientation": 0
}

Metadata

Release files for amazon-textract-pipeline-pagedimensions 0.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for amazon-textract-pipeline-pagedimensions 0.0.9
File Size Uploaded Provenance Actions
amazon-textract-pipeline-pagedimensions-0.0.9.tar.gz 8.8 kB Without provenance Details for amazon-textract-pipeline-pagedimensions-0.0.9.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for amazon-textract-pipeline-pagedimensions 0.0.9
File Interpreter ABI Platform Actions
amazon_textract_pipeline_pagedimensions-0.0.9-py2.py3-none-any.whl Python 3, Python 2 none any Details for amazon_textract_pipeline_pagedimensions-0.0.9-py2.py3-none-any.whl

Total release size: 18.1 kB

Release files / amazon-textract-pipeline-pagedimensions-0.0.9.tar.gz

Download URL amazon-textract-pipeline-pagedimensions-0.0.9.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
efafbaf97d11a2c25ac2a69362a0ff7d98883ff5341f9349ad5021619e4ec4f2
BLAKE2b-256 checksum
How to use checksums
c4c173efaf519831daca742cf181458fc9097542f037636f7a2b3112c53fe61a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.6

Release files / amazon_textract_pipeline_pagedimensions-0.0.9-py2.py3-none-any.whl

Download URL amazon_textract_pipeline_pagedimensions-0.0.9-py2.py3-none-any.whl
Size 9.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
d8f4d40c0e14f24664077677af79f40c3858e2344f7f6cf38e0bb8961bdadb5e
BLAKE2b-256 checksum
How to use checksums
85e84e12c544ccc841ac5669d47a30f837ddaafe2477afd60baa029c9de2afbc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.6

Security for amazon-textract-pipeline-pagedimensions 0.0.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page