{"id":23245,"library":"amazon-textract-prettyprinter","title":"Amazon Textract PrettyPrinter","description":"A helper library for pretty printing Amazon Textract responses, providing a simple interface to convert Textract JSON output into formatted text, HTML, CSV, Markdown, and other formats. It is part of the amazon-textract-textractor suite. Current version: 0.1.10 (PyPI), but the repo is part of a larger project with versions up to 1.9.2. Release cadence is irregular; the PyPI package has not been updated since 2022. Requires Python >=3.6.","status":"active","version":"0.1.10","language":"python","source_language":"en","source_url":"https://github.com/aws-samples/amazon-textract-textractor/tree/master/prettyprinter","tags":["amazon-textract","pretty-print","textract","aws","ocr","formatting"],"install":[{"cmd":"pip install amazon-textract-prettyprinter","lang":"bash","label":"Install via pip"},{"cmd":"pip install amazon-textract-prettyprinter[html,csv]","lang":"bash","label":"Install with optional format dependencies"}],"dependencies":[{"reason":"Required for calling Textract API and converting response to PrettyPrinter compatible objects","package":"amazon-textract-caller","optional":false},{"reason":"Required for parsing Textract JSON into response objects","package":"amazon-textract-response-parser","optional":false},{"reason":"Legacy dependency, required for older format support","package":"trp","optional":true}],"imports":[{"note":"Common mistake - the package name uses underscores, not hyphens, in import path","wrong":"from amazon_textract_prettyprinter import Textract_PrettyPrint","symbol":"Textract_PrettyPrint","correct":"from textractprettyprinter.t_pretty_print import Textract_PrettyPrint"}],"quickstart":{"code":"import boto3\nfrom textractcaller.t_call import call_textract\nfrom textractprettyprinter.t_pretty_print import Textract_PrettyPrint\n\n# Call Textract API (make sure AWS credentials are configured)\nclient = boto3.client('textract', region_name='us-east-1')\nresponse = call_textract(input_document=\"s3://bucket/document.pdf\", client=client)\n\n# Pretty print as text\npretty_printer = Textract_PrettyPrint()\ntext_output = pretty_printer.print_text(response)\nprint(text_output)\n\n# Pretty print as CSV (columns: Key, Value)\ncsv_output = pretty_printer.print_csv(response)\nprint(csv_output)","lang":"python","description":"Minimal example: call Textract on a PDF and print the response as plain text and CSV."},"warnings":[{"fix":"Install from the main repository: pip install amazon-textract-textractor (which includes prettyprinter).","message":"The PyPI package version (0.1.10) is outdated and does not match the GitHub project versioning. Some features may be missing or broken. Use the package from the main repository (amazon-textract-textractor) for latest features.","severity":"breaking","affected_versions":"0.1.10"},{"fix":"Use correct import: from textractprettyprinter.t_pretty_print import Textract_PrettyPrint","message":"The import path uses 'textractprettyprinter' (all lowercase, no hyphens) which is unusual. Many users mistake it for 'amazon_textract_prettyprinter'.","severity":"deprecated","affected_versions":"all"},{"fix":"Use call_textract from textractcaller to get the response, then pass to PrettyPrint methods.","message":"The library assumes you have already called Textract and parsed the response. It does not call the Textract API itself. You must use amazon-textract-caller (or boto3 directly) to get the response object.","severity":"gotcha","affected_versions":"all"},{"fix":"Install with extras: pip install amazon-textract-prettyprinter[html,csv,markdown]","message":"CSV, HTML, and Markdown output requires optional dependencies. If you try to use them without installing extras, you'll get ModuleNotFoundError.","severity":"gotcha","affected_versions":"0.1.10"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install the package: pip install amazon-textract-prettyprinter, then use: from textractprettyprinter.t_pretty_print import Textract_PrettyPrint","cause":"Incorrect package name used in import (e.g., amazon_textract_prettyprinter)","error":"ModuleNotFoundError: No module named 'textractprettyprinter'"},{"fix":"Check that call_textract or boto3 Textract call returns a valid response with 'Blocks' key. Add error handling for Textract API failures.","cause":"The response object passed to PrettyPrint methods is None or invalid. Usually happens when the Textract API call fails or returns an error.","error":"AttributeError: 'NoneType' object has no attribute 'get'"},{"fix":"Use: from textractprettyprinter.t_pretty_print import Textract_PrettyPrint","cause":"The user imported directly from textractprettyprinter instead of from textractprettyprinter.t_pretty_print","error":"ImportError: cannot import name 'Textract_PrettyPrint' from 'textractprettyprinter'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}