Sign inSign up

pdfix/pdf-accessibility-paddle

By pdfix

Updated 8 days ago

Image
0

3.8K

pdfix/pdf-accessibility-paddle repository overview

PDF Accessibility Paddle

Uses PaddleX models for layout and formula recognition, running fully offline. 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-paddle:v1.2.2 <command> [options]

Commands

  • tag: Autotag a PDF (PDF → PDF)
  • template: Create a layout template JSON (PDF → JSON)
  • mathml: MathML from formulas in a PDF or from a formula image (PDF → PDF or image → XML)

Arguments

Common (tag / template)
OptionRequiredType / expected valueDescription
--input, -iyesPath to an existing .pdf fileInput PDF
--output, -oyesPath for .pdf/.json depending on commandOutput file
--namenoString (PDFix account license name)PDFix license name
--keynoString (PDFix account license key)PDFix license key
--modelnoPP-DocLayout-L or RT-DETR-H_layout_17cls (default: PP-DocLayout-L)Layout model
--zoomnoFloat, range 1.0–10.0 (default 2.0)Page render zoom
--process_tablenoBoolean string (default: true)Process tables
tag only
OptionRequiredType / expected valueDescription
--process_formulanoBoolean string (default: true)Process formulas
Threshold options (tag / template)

Each value is clamped to 0.05–0.95.

OptionDefaultType / expected value
--threshold_paragraph_title0.3Float
--threshold_image0.5Float
--threshold_text0.5Float
--threshold_number0.5Float
--threshold_abstract0.5Float
--threshold_content0.5Float
--threshold_figure_title0.5Float
--threshold_formula0.3Float
--threshold_table0.5Float
--threshold_table_title0.5Float
--threshold_reference0.5Float
--threshold_doc_title0.5Float
--threshold_footnote0.5Float
--threshold_header0.3Float
--threshold_algorithm0.5Float
--threshold_footer0.5Float
--threshold_seal0.3Float
--threshold_chart_title0.5Float
--threshold_chart0.5Float
--threshold_formula_number0.5Float
--threshold_header_image0.3Float
--threshold_footer_image0.5Float
--threshold_aside_text0.5Float
mathml
OptionRequiredType / expected valueDescription
--input, -iyesPath to .pdf or supported image fileInput
--output, -oyesPath to .pdf or .xml matching modeOutput
--paramsfor PDF → PDFPath to a .json fileTag filter parameters (see Params JSON)
--namenoString (PDFix license); use for PDF → PDF without watermarksPDFix license name
--keynoString (PDFix license); use for PDF → PDF without watermarksPDFix license key

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 mathml only).

tag_names

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

Example (tests/params_mathml.json) — match 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": "Formula",
        "values": [
            {
                "desc": "All tags",
                "value": ".*"
            }
        ]
    }
]

Use "value": ".*" to match all tags.

Examples

Tag a PDF:

docker run --rm -v "$(pwd)":/data -w /data pdfix/pdf-accessibility-paddle:v1.2.2 \
  tag --name "${LICENSE_NAME}" --key "${LICENSE_KEY}" \
  -i /data/input.pdf -o /data/tagged.pdf --zoom 3.0 --process_formula false --threshold_text 0.6

Create a layout template JSON:

docker run --rm -v "$(pwd)":/data -w /data pdfix/pdf-accessibility-paddle:v1.2.2 \
  template -i /data/input.pdf -o /data/template.json --zoom 3.0 --threshold_text 0.6

MathML for Formula tags in a PDF:

docker run --rm -v "$(pwd)":/data -w /data pdfix/pdf-accessibility-paddle:v1.2.2 \
  mathml --name "${LICENSE_NAME}" --key "${LICENSE_KEY}" \
  -i /data/input.pdf -o /data/output.pdf --params /data/tests/params_mathml.json

MathML from one formula image:

docker run --rm -v "$(pwd)":/data -w /data pdfix/pdf-accessibility-paddle:v1.2.2 \
  mathml -i /data/formula.jpg -o /data/formula.xml

Help & support

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

Licenses

Tag summary

Content type

Image

Digest

sha256:a471c526e

Size

2.4 GB

Last updated

about 1 month ago

docker pull pdfix/pdf-accessibility-paddle