Sign inSign up

pdfix/pdf-accessibility-openai

By pdfix

Updated 2 days ago

Image
0

6.3K

pdfix/pdf-accessibility-openai repository overview

PDF Accessibility OpenAI

Utilizes OpenAI models (cloud-based) to describe images and formulas. Requires an OpenAI API key. For PDF output without watermarks, a PDFix SDK license is required.

Table of Contents

Getting started

You need Docker installed. The first run downloads the image and may take longer than later runs.

Usage

Mount a folder into the container and run a subcommand:

docker run --rm -v "$(pwd)":/data -w /data pdfix/pdf-accessibility-openai:v1.3.5 <command> [options]

Commands

  • generate-alt-text: Alternate text for images (PDF → PDF; image/XML → TXT)
  • generate-table-summary: Table summaries (PDF → PDF; image → TXT)
  • generate-mathml: MathML for formulas (PDF → PDF; image → TXT)

Arguments

Common (OpenAI commands)
OptionRequiredType / expected valueDescription
--openai-keyyesString (OpenAI API key)OpenAI API key
--input, -iyesPath to .pdf, image, or .xml as supported by the commandInput file
--output, -oyesPath to output .pdf, .txt, or .xml as supportedOutput file
--modelnoOne of: chat-latest, gpt-4-turbo, gpt-4.1, gpt-4.1-mini, gpt-4.1-nano, gpt-4o, gpt-4o-mini, gpt-5, gpt-5-mini, gpt-5-nano, gpt-5.2, gpt-5.4-mini, gpt-5.4-nano, gpt-5.5, gpt-5.6-luna, gpt-5.6-sol, gpt-5.6-terra, gpt-6-astra, o1, o3, o3-mini, o4-mini (default: gpt-4o-mini)OpenAI model
--promptnoPrompt text or path to a .txt fileCustom prompt
--paramsfor PDF → PDFPath to a .json fileTag filter parameters (see Params JSON)
--tags-countnoInteger (default 2); PDF onlySurrounding tags in prompt
--namenoString (PDFix account license name)PDFix license name
--keynoString (PDFix account license key)PDFix license key
generate-alt-text
OptionRequiredType / expected valueDescription
--langnoLanguage code string (default: en)Output language
--overwritenoBoolean string (default: false)Overwrite existing Alt text

Default tag filter when --params is omitted: Figure|Formula.

generate-table-summary
OptionRequiredType / expected valueDescription
--langnoLanguage code string (default: en)Output language
--overwritenoBoolean string (default: false)Overwrite existing summary

Default tag filter when --params is omitted: Table.

generate-mathml
OptionRequiredType / expected valueDescription
--mathml-versionnoOne of: mathml-1, mathml-2, mathml-3, mathml-4 (default: mathml-4)MathML version
--overwritenoBoolean string (default: false)Overwrite existing output

Default tag filter when --params is omitted: Formula.

Params JSON

--params points to a JSON array of parameter objects. Each object has at least name and value; the CLI reads those fields to decide which tags to process (PDF → PDF only).

tag_names

tag_names is an ECMAScript regular expression matching tag names, or a template tag_update object.

Example (tests/params_alt_text.json) — match Figure or Formula tags:

[
    {
        "title": "Tags",
        "desc": "Specify the tags using a ECMAScript regular expression or define them by template tag_update",
        "name": "tag_names",
        "type": "tag",
        "value": "Figure|Formula",
        "values": [
            {
                "desc": "All tags",
                "value": ".*"
            }
        ]
    }
]

Use "value": ".*" to match all tags. Command-specific defaults:

CommandDefault tag_names
generate-alt-textFigure|Formula
generate-table-summaryTable
generate-mathmlFormula

Examples

Generate alternate text:

docker run --rm -v "$(pwd)":/data -w /data pdfix/pdf-accessibility-openai:v1.3.5 \
  generate-alt-text --openai-key "${OPENAI_API_KEY}" \
  --name "${LICENSE_NAME}" --key "${LICENSE_KEY}" \
  --input /data/document.pdf --output /data/out.pdf \
  --params /data/tests/params_alt_text.json --lang en --overwrite true

Help & support

For PDFix SDK licensing or issues, contact [email protected].

Licenses

Tag summary

Content type

Image

Digest

sha256:ae21ea493

Size

248.7 MB

Last updated

about 1 month ago

docker pull pdfix/pdf-accessibility-openai