Skip to content

Commit 8b1443c

Browse files
authored
Merge pull request #1493 from BBC-Esq/main
fix ._hocr
2 parents d84c478 + 0970ceb commit 8b1443c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/ocrmypdf/hocrtransform/_hocr.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,13 @@ def to_pdf(
263263

264264
def _get_text_direction(self, par):
265265
"""Get the text direction of the paragraph.
266-
266+
267267
Arabic, Hebrew, Persian, are right-to-left languages.
268+
When the paragraph element is None, defaults to left-to-right.
268269
"""
270+
if par is None:
271+
return TextDirection.LTR
272+
269273
return (
270274
TextDirection.RTL
271275
if par.attrib.get('dir', 'ltr') == 'rtl'

0 commit comments

Comments
 (0)