Skip to main content

HOCkeR

Python package for combining hOCR files and images into searchable PDFs

Table of Contents

  1. What is hoCKeR?
  2. How to install
  3. How to Use
  4. Credits

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

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)

Source distribution for hocker 1.0.4
File Size Uploaded
hocker-1.0.4.tar.gz 280.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hocker 1.0.4
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 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