Compare commits

...
9 Commits
7 changed files with 48 additions and 16 deletions
@@ -1,4 +1,4 @@
name: General issues
name: Installation, packaging, dependencies
description: Installation, packages, dependencies, "nothing works", test suite failures...
title: "[Bug]: "
labels: ["bug", "triage"]
@@ -9,6 +9,10 @@ body:
attributes:
value: |
Thanks for taking the time to fill out this bug report!
If your issue involves using OCRmyPDF on specific file(s) and not getting
good results, this is the *wrong* issue template. Please use the recommended
template to ensure we have enough information to help.
- type: textarea
id: what-happened
attributes:
@@ -32,7 +32,20 @@ body:
attributes:
label: Files
description: Please attach the input and output files, or any screenshots that may be helpful.
placeholder: Drag and drop files here
placeholder: |
Drag and drop files here.
If you cannot provide a test file, we probably won't be able to help with the issue.
PDF is a complex file format, and there may be technical details in the PDF that are
causing the issue. There's really no substitute for a test file.
We understand files may contain personal or sensitive information. Here are some options:
- Try reproducing the issue with a file from the test suite. (See tests/resources)
- Try to create another file in the same way as your private file.
- Encrypt the file to OCRmyPDF's private GPG key.
- Use ``qpdf --json yourfile.pdf`` to produce a JSON representation of your file that
omits personal information.
- type: dropdown
id: packaging-system
attributes:
+4 -3
View File
@@ -225,8 +225,9 @@ jobs:
python -m pip install --upgrade pip wheel build
python -m build --sdist --wheel
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: artifact
path: |
./dist/*.whl
./dist/*.tar.gz
@@ -240,7 +241,7 @@ jobs:
id-token: write # mandatory for PyPI publishing
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist
@@ -257,7 +258,7 @@ jobs:
# Required to create a release
contents: write
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist
+16 -2
View File
@@ -30,8 +30,22 @@ OCRmyPDF typically supports the three most recent Python versions.
.. |OCRmyPDF PyPI| image:: https://img.shields.io/pypi/v/ocrmypdf.svg
v16.0.0rc1
==========
v16.0.2
=======
- Temporarily changed PDF text renderer back to sandwich by default to address
regressions in macOS Preview.
v16.0.1
=======
- Fixed text rendering issue with new hOCR text renderer - extraneous byte order
marks.
- Tightened dependencies.
v16.0.0
=======
- Added OCR text renderer, combined the best ideas of Tesseract's PDF
generator and the older hOCR transformer renderer. The result is a hopefully
+3 -3
View File
@@ -14,11 +14,11 @@ requires-python = ">=3.10"
dependencies = [
"Pillow>=10.0.1",
"deprecation>=2.1.0",
"img2pdf>=0.4.4",
"img2pdf>=0.5",
"packaging>=20",
"pdfminer.six>=20220319",
"pikepdf>=8.8.0",
"pluggy>=0.13.0",
"pikepdf>=8.10.1",
"pluggy>=1",
"rich>=13",
]
authors = [{ name = "James R. Barlow", email = "james@purplerock.ca" }]
@@ -146,7 +146,7 @@ def check_options(options):
# Decide on what renderer to use
if options.pdf_renderer == 'auto':
options.pdf_renderer = 'hocr'
options.pdf_renderer = 'sandwich'
if not tesseract.has_thresholding() and options.tesseract_thresholding != 0:
log.warning(
+5 -5
View File
@@ -106,10 +106,10 @@ class HocrTransform:
self.render_options = DebugRenderOptions(
render_baseline=debug,
render_triangle=debug,
render_line_bbox=debug,
render_line_bbox=False,
render_word_bbox=debug,
render_paragraph_bbox=debug,
render_space_bbox=debug,
render_paragraph_bbox=False,
render_space_bbox=False,
)
def _get_element_text(self, element: Element):
@@ -365,7 +365,7 @@ class HocrTransform:
if font_width > 0:
text.text_transform(Matrix(1, 0, 0, 1, box.llx, 0))
text.horiz_scale(100 * box.width / font_width)
text.show(elemtxt)
text.show(elemtxt.encode('utf-16be'))
# Get coordinates of the next word (if there is one)
hocr_next_box = (
@@ -389,7 +389,7 @@ class HocrTransform:
space_width = self._font.text_width(' ', fontsize)
if space_width > 0:
text.horiz_scale(100 * space_box.width / space_width)
text.show(' ')
text.show(' '.encode('utf-16be'))
def _debug_draw_paragraph_boxes(self, canvas: Canvas, color=CYAN):
"""Draw boxes around paragraphs in the document."""