pdfalto
Python bindings for pdfalto, a PDF to ALTO XML converter built on xpdf and used as the PDF parsing front end of GROBID.
The wheels bundle the compiled pdfalto executable, so there is nothing else
to install:
$ pip install pdfalto
Python API
import pdfalto
result = pdfalto.convert("paper.pdf", "paper.xml", outline=True)
print(result.alto) # paper.xml
print(result.metadata) # paper_metadata.xml
print(result.outline) # paper_outline.xml
print(result.data_dir) # paper.xml_data/ (extracted images and vector graphics)
convert() returns a ConversionResult naming every file that was written.
Sidecar attributes are None when the corresponding file was not produced.
To skip the files entirely:
alto_xml = pdfalto.convert_to_string("paper.pdf")
Every pdfalto option is a keyword argument, named after the flag it sets:
pdfalto.convert(
"paper.pdf", "paper.xml",
first_page=1, last_page=10, # -f 1 -l 10
skip_graphics=True, # -skipGraphs
no_line_numbers=True, # -noLineNumbers
owner_password="secret", # -opw secret
)
See help(pdfalto.convert) for the full list. Anything not modelled there can
be passed through verbatim:
pdfalto.convert("paper.pdf", extra_args=["-someNewFlag"])
pdfalto.run(["-v"]) # raw call, no exit-status checking
Errors
A failing conversion raises PdfAltoError, carrying the exit status, the
command line and the captured stderr:
try:
pdfalto.convert("broken.pdf")
except pdfalto.PdfAltoError as exc:
print(exc.returncode, exc.stderr)
Pass check=False to get a ConversionResult with a non-zero returncode
instead. Exit status 5 is not an error: the ALTO file was written correctly,
but pdfalto had to disable page streaming partway through, so its peak memory
was no longer bounded. That case is reported as
result.streaming_disabled is True.
Command line
Installing the package puts pdfalto on PATH, with the upstream command line
unchanged:
$ pdfalto -outline paper.pdf paper.xml
This is the executable itself, not a Python wrapper around it, so it starts as fast as a hand-built binary (~7 ms rather than ~100 ms) — which matters when something invokes it once per PDF.
It is installed the way any Unix program is, into the environment's bin/ with
its resources in share/pdfalto/:
<venv>/bin/pdfalto
<venv>/share/pdfalto/xpdfrc
<venv>/share/pdfalto/languages/
pdfalto finds them relative to itself. PDFALTO_DATA_DIR overrides the lookup
if you ever need to point it somewhere else.
Notes on the wheels
-
Wheels are
py3-none-<platform>: the package ships an executable rather than an extension module, so one wheel covers every supported Python. -
Platforms: Linux x86-64 and aarch64, macOS arm64 and x86-64. On any other platform pip falls back to the source distribution, which runs the CMake build and needs a C++17 compiler and CMake ≥ 3.15.
-
The bundled binaries are built without fontconfig, so a conversion does not depend on the fonts installed on the machine and gives the same result everywhere. The binaries published on the pdfalto GitHub releases page do use fontconfig for substituting non-embedded fonts. To get that behaviour:
$ pip install pdfalto --no-binary pdfalto -C cmake.define.NO_FONTCONFIG=OFF
-
PDFALTO_BINARY=/path/to/pdfaltomakes the Python API run a different executable, which is handy for testing a local CMake build. Without it the API runs thepdfaltoinstalled in the current environment, falling back to a binary built in a surrounding checkout, so an editable install works too.
License
Same as pdfalto itself; see the LICENSE file in the repository.
Release files for pdfalto 0.6.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pdfalto-0.6.3.tar.gz | 68.6 MB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| pdfalto-0.6.3-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl | Python 3 | none | Linux glibc 2.28+ x86-64, Linux glibc 2.26+ x86-64 | Details |
| pdfalto-0.6.3-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl | Python 3 | none | Linux glibc 2.28+ ARM64, Linux glibc 2.26+ ARM64 | Details |
| pdfalto-0.6.3-py3-none-macosx_11_0_x86_64.whl | Python 3 | none | macOS 11.0+ x86-64 | Details |
| pdfalto-0.6.3-py3-none-macosx_11_0_arm64.whl | Python 3 | none | macOS 11.0+ ARM64 | Details |
Total release size: 143.8 MB
Release files / pdfalto-0.6.3.tar.gz
| Download URL | pdfalto-0.6.3.tar.gz |
|---|---|
| Size | 68.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b7e33ba98ddd97b20a6f90e32b410a033abb6345c079af7137768d386ef33832
|
|
BLAKE2b-256 checksum How to use checksums |
11d534974c789e3b9a274d5f7ac3f75d228cfd5f3d475937776600f52e6326fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.
Transparency logRelease files / pdfalto-0.6.3-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pdfalto-0.6.3-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 19.0 MB |
| Tags | Linux glibc 2.26+ x86-64 Linux glibc 2.28+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
6526c415d8964519f293cb0a24f5ae04ea1c084946aea548dab7308d74640cd3
|
|
BLAKE2b-256 checksum How to use checksums |
d4cb113f35cd40bc307f47b2f162812902e26aaa7ff634eff2a8b46d39d76a77
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.
Transparency logRelease files / pdfalto-0.6.3-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
| Download URL | pdfalto-0.6.3-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 18.9 MB |
| Tags | Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
ac802de19dd497451b028a6b7fa35207d3bcd3f4cf16f81f563beff1e0ac3937
|
|
BLAKE2b-256 checksum How to use checksums |
c1b50258922cdbe6ae76e3cbdb841ec6a71b121ada97daa5eee1831d5b38f21d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.
Transparency logRelease files / pdfalto-0.6.3-py3-none-macosx_11_0_x86_64.whl
| Download URL | pdfalto-0.6.3-py3-none-macosx_11_0_x86_64.whl |
|---|---|
| Size | 18.5 MB |
| Tags | Python 3 macOS 11.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
95e8b0cccbd199ad8a305898605b9c0eb66ff0a9bc8dc227c7e9651e45d1ef0b
|
|
BLAKE2b-256 checksum How to use checksums |
8fbad280724aec8edaef093181f54509188a6e0aeea0fa6c822faf8d6ebbc7f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.
Transparency logRelease files / pdfalto-0.6.3-py3-none-macosx_11_0_arm64.whl
| Download URL | pdfalto-0.6.3-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 18.8 MB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
13a7504f62ddf4670b0e24fcfe7e4151d0aa6d253043832342d0104fdb1fcbfd
|
|
BLAKE2b-256 checksum How to use checksums |
77d099a45eba210200add6e3fa4e5d3cd0d5cbec893e812da8ecc9cd2eb31bcd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.
Transparency log