Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow for negative values of the bbox #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/hocr-pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def export_pdf(playground, default_dpi):

def add_text_layer(pdf, image, height, dpi):
"""Draw an invisible text layer for OCR data"""
p1 = re.compile('bbox((\s+\d+){4})')
p1 = re.compile('bbox((\s+[\d\-]+){4})')
p2 = re.compile('baseline((\s+[\d\.\-]+){2})')
hocrfile = os.path.splitext(image)[0] + ".hocr"
hocr = etree.parse(hocrfile, html.XHTMLParser())
Expand Down Expand Up @@ -157,4 +157,4 @@ def load_invisible_font():
"directory with the hOCR and JPEG files (corresponding JPEG and hOCR files have to have the same name with their respective file ending)"
)
args = parser.parse_args()
export_pdf(args.imgdir, 300)
export_pdf(args.imgdir, 300)