Skip to main content
Files added late

3 files were added to this release more than 14 days after its initial publication. Inspect the release files before installing.

py-pagexml: Python wrapper for the PageXML C++ library

The py-pagexml python package is a library of functions that eases working with omni:us Pages Format XML files (referred to as OPF XML files). It allows you from python to read an OPF file, extract information contained within, modify or add content, create an OPF from scratch, crop parts for page images, etc.

By default OPF XML files are validated against the XSD schema when reading, saving, or on request by calling a function. The documentation the XSD schema and the schema itself included in py-pagexml can be found at:

The official online documentation of py-pagexml is available at https://omni-us.github.io/pagexml/py-pagexml.

The py-pagexml package can be built with two modes: normal and slim. As the name implies, the slim build is smaller but more importantly it has less library dependencies. This also means that there are some features which are not available, namely: functions related to images, e.g. PageXML.crop; and functions that perform intersections of polygons, e.g. PageXML.selectByOverlap.

Software dependencies

The core of py-pagexml is a compiled C++ library that links with a few libraries, so it requires installation of dependencies that cannot be automatically obtained from pypi servers.

There are docker images available at docker hub which include both the runtime and the build dependencies already installed. In particular the runtime docker images are intended to be used as base images for applications that use pagexml. The specific list of dependencies both for runtime and building are listed below.

Runtime dependencies

Slim:
  • python3

Normal (in addition to the previous):
  • libopencv-imgcodecs (Ubuntu 18.04/20.04) | libopencv-highgui (Ubuntu 16.04)

  • libopencv-imgproc

  • libopencv-core

  • libgdal

Building dependencies

Slim:
  • python3-setuptools

  • python3-pkgconfig

  • python3-wheel

  • python3-dev

  • swig

Normal (in addition to the previous):
  • libopencv-dev

  • libgdal-dev

  • libboost-all-dev

Installation from wheel binary file

If you have configured a pypi server that includes pagexml, installation is as simple as:

pip3 install pagexml

The slim build has a different name, thus the install comand would be:

pip3 install pagexml_slim

Otherwise you can install it from a github release. Each release includes multiple wheel files. One for python 3.5 which is built for Ubuntu 16.04, another for python 3.6 built for Ubuntu 18.04 and another for python 3.8 built for Ubuntu 20.04. Once you have located the appropriate wheel file, copy the link and run as follows replacing the URL with the one you copied:

pip3 install https://github.com/omni-us/pagexml/releases/download/20*/pagexml-20*-linux_x86_64.whl

Building the wheel file from source

Clone the github repository https://github.com/omni-us/pagexml.git, go to the py-pagexml directory and then run:

pip3 install --editable .[dev]
./setup.py bdist_wheel

To build the slim package, give the --slim command line option, e.g.:

./setup.py bdist_wheel --slim

Simple usage examples

Create a new Page XML adding regions, text and properties

import pagexml
pxml = pagexml.PageXML()

# Create a new page xml
file = 'example_image.jpg'
width = 400
height = 200
pxml.newXml('name-and-version-of-tool', file, width, height)

# Add a text region to the Page
page = pxml.selectNth('//_:Page', 0)
reg = pxml.addTextRegion(page)

# Set text region bounding box with a confidence
pxml.setCoordsBBox(reg, 10, 20, 80, 60, 0.8)

# Set the text for the text region with a confidence
pxml.setTextEquiv(reg, 'lorem ipsum', 0.9)

# Add property to text region
pxml.setProperty(reg, 'key', 'value')

# Add a second page with a text region and specific id
page = pxml.addPage('example_image_2.jpg', 300, 300)
reg = pxml.addTextRegion(page, 'regA')
pxml.setCoordsBBox(reg, 15, 12, 76, 128)

# Write XML to file
pxml.write('example_image.xml')

Modify an existing Page XML

# Load an existing XML
import pagexml
pxml = pagexml.PageXML('example_image.xml')

# Add content to loaded XML
pxml.setProperty(pxml.selectNth('//_:Page', 0), 'key', 'value')

# Write XML to file
pxml.write('example_image_2.xml')

Crop an element and save image to disk

# Load an existing XML
import pagexml
pxml = pagexml.PageXML('examples/lorem.xml')

# Crop element with specific ID
cropped = pxml.crop('//*[@id="r1_l1"]/_:Coords')[0]

# Save image to disk
pagexml.imwrite(cropped.name+'.png', cropped.image)

Metadata

Release files for pagexml-slim 2022.4.12

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

Files added late

3 files were uploaded more than 14 days after the first file in this release.

While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.

We recommend inspecting the release files before installing.

Built distributions (wheels)

Table of built distributions (wheels) for pagexml-slim 2022.4.12
File
pagexml_slim-2022.4.12-cp313-cp313-manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64 Details
pagexml_slim-2022.4.12-cp312-cp312-manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64 Details
pagexml_slim-2022.4.12-cp311-cp311-manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64 Details
pagexml_slim-2022.4.12-cp310-cp310-manylinux_2_24_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.24+ x86-64 Details
pagexml_slim-2022.4.12-cp39-cp39-manylinux_2_24_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.24+ x86-64 Details
pagexml_slim-2022.4.12-cp38-cp38-manylinux_2_24_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.24+ x86-64 Details
pagexml_slim-2022.4.12-cp37-cp37m-manylinux_2_24_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.24+ x86-64 Details
pagexml_slim-2022.4.12-cp36-cp36m-manylinux_2_24_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.24+ x86-64 Details

Total release size: 15.6 MB

Release files / pagexml_slim-2022.4.12-cp313-cp313-manylinux_2_28_x86_64.whl

File added late

This file was uploaded more than 14 days after the first file in this release.

While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.

We recommend inspecting the release file before installing.

Download URL pagexml_slim-2022.4.12-cp313-cp313-manylinux_2_28_x86_64.whl
Size 2.0 MB
Tags CPython 3.13 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
b70d61036f036fb3a119e4304d9a71b49f45d21d5d673ccbdc850bec7136fafd
BLAKE2b-256 checksum
How to use checksums
ea4ce758c70cfaf9606cb81c33a83760b8bb39070b506abb2e172587e4db7dbf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.12

Release files / pagexml_slim-2022.4.12-cp312-cp312-manylinux_2_28_x86_64.whl

File added late

This file was uploaded more than 14 days after the first file in this release.

While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.

We recommend inspecting the release file before installing.

Download URL pagexml_slim-2022.4.12-cp312-cp312-manylinux_2_28_x86_64.whl
Size 2.0 MB
Tags CPython 3.12 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
67c5c3b580cdca888557ee84ddba2a90457040686c77ab39bdc1f8110bac6a19
BLAKE2b-256 checksum
How to use checksums
6e44d6415719785420e6b4bbf24f1432269fbf2bb3f547fda15db59d1846a20d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.12

Release files / pagexml_slim-2022.4.12-cp311-cp311-manylinux_2_28_x86_64.whl

File added late

This file was uploaded more than 14 days after the first file in this release.

While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.

We recommend inspecting the release file before installing.

Download URL pagexml_slim-2022.4.12-cp311-cp311-manylinux_2_28_x86_64.whl
Size 2.0 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
9ce82cfc8b5cdb86ea266d268fa396e5b2fc4eef79f33c1b0ad03755e89323bc
BLAKE2b-256 checksum
How to use checksums
55c41246d8002197261abe9fcef98917848ac45af5d746d8d436fcf379326f13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.12

Release files / pagexml_slim-2022.4.12-cp310-cp310-manylinux_2_24_x86_64.whl

Download URL pagexml_slim-2022.4.12-cp310-cp310-manylinux_2_24_x86_64.whl
Size 1.9 MB
Tags CPython 3.10 Linux glibc 2.24+ x86-64
SHA-256 checksum
How to use checksums
4de0fdf955f542678c37e9666f0a2d625e03177f280a30c974a9b2096dde4baf
BLAKE2b-256 checksum
How to use checksums
0d5dc30d44f4a96fd6730311fa4aabde3e5003000ce0e33aad88c76039336da7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.12

Release files / pagexml_slim-2022.4.12-cp39-cp39-manylinux_2_24_x86_64.whl

Download URL pagexml_slim-2022.4.12-cp39-cp39-manylinux_2_24_x86_64.whl
Size 1.9 MB
Tags CPython 3.9 Linux glibc 2.24+ x86-64
SHA-256 checksum
How to use checksums
0851ade446a9dbba6bdf93687af24a6589f264e50077399b6cfeb957eee840d6
BLAKE2b-256 checksum
How to use checksums
f0589ee364bcad0d3b74649a6f73852084f660ddc03f129c458ddeb63738475b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.12

Release files / pagexml_slim-2022.4.12-cp38-cp38-manylinux_2_24_x86_64.whl

Download URL pagexml_slim-2022.4.12-cp38-cp38-manylinux_2_24_x86_64.whl
Size 1.9 MB
Tags CPython 3.8 Linux glibc 2.24+ x86-64
SHA-256 checksum
How to use checksums
688c1668f16f4a7eee540aecfb86f2b0485d18d1462c8c8286060fd20b118d2d
BLAKE2b-256 checksum
How to use checksums
743f9758f878c11b83cd6b5a3a20cb7413c30f7a7e5ffbd75de2ca22ff698aec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.12

Release files / pagexml_slim-2022.4.12-cp37-cp37m-manylinux_2_24_x86_64.whl

Download URL pagexml_slim-2022.4.12-cp37-cp37m-manylinux_2_24_x86_64.whl
Size 1.9 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.24+ x86-64
SHA-256 checksum
How to use checksums
017aa8e428fc5f2b0564186aa8fb8b72056ced59348698a865161b48d29511a1
BLAKE2b-256 checksum
How to use checksums
a23fd1a248ff1ca7bac2740857f3bc1d5fefc754f3a2e41e6bb1dba9014e3924
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.12

Release files / pagexml_slim-2022.4.12-cp36-cp36m-manylinux_2_24_x86_64.whl

Download URL pagexml_slim-2022.4.12-cp36-cp36m-manylinux_2_24_x86_64.whl
Size 1.9 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.24+ x86-64
SHA-256 checksum
How to use checksums
b6e0bcfe248e1beedea6cc1b7c7ef8b7126e62627ea21b8c9f44bbc803463e70
BLAKE2b-256 checksum
How to use checksums
a148e90a51466a7d6b891918730422ba1fe3e4d5b325abe2813eec359edf6642
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.12

Release history Release notifications | RSS feed

This release

2022.4.12 This release

8 release files

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