HOCkeR
Python package for combining hOCR files and images into searchable PDFs
Table of Contents
What is hOCkeR?
HOCkeR is a Python package for combining hOCR files and images into searchable PDFs. The package lays the text on top of the image, and then creates a PDF with the text and image. The code used is from HOCRConverter by jbrinley. The code was designed for Python 2, therefore does not work with newer version of python, so I created this package as an update to the original code.
How to install
To install the package, run the following command within a python environment:
pip install hocker
If any errors occur whilst installing, try using the .whl file instead linked here
How to use hOCkeR
Below is an example of how to use hOCkeR to combine an png and a .hocr file into a PDF
import hocker as hkr
image_path = 'path/to/image.png'
hocr_path = 'path/to/image.hocr'
# Specify the element in the hocr file to use as the text
hocr = hkr.HOCRCombiner('ocrx_word') # For tesseract outputs, it is 'ocrx_word'
# Specify the hocr and image path
hocr.locate_image(image_path)
hocr.locate_hocr(hocr_path)
# Output the PDF
hocr.to_pdf('path/to/output.pdf')
Credits & links
- hOCKeR by Lucas Warwick
- HOCRConverter by jbrinley
Release files for hocker 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hocker-1.0.4.tar.gz | 280.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hocker-1.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 285.7 kB
Release files / hocker-1.0.4.tar.gz
| Download URL | hocker-1.0.4.tar.gz |
|---|---|
| Size | 280.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2886ccba7f5c7eca5c0ea4d98ac323f8c2da2c060b00f21361bbd8263dcf5c57
|
|
BLAKE2b-256 checksum How to use checksums |
ec2eec87c41d23a94cd257cc94a2c92cd08feaf15e5a79915d046c69c5749b38
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.12
|
Release files / hocker-1.0.4-py3-none-any.whl
| Download URL | hocker-1.0.4-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4148b95bb2f5428f06d5186d0af2f18c2d29ebc46d34daf2edcc26aaf17e56dc
|
|
BLAKE2b-256 checksum How to use checksums |
24de8e0cbf53aa8a4e8239e54e813114d6a75398b0c06db40617c7dd9adebab9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.12
|