Skip to content

Commit

Permalink
Merge pull request #140 from funstory-ai/feat/support-xobject-in-scan…
Browse files Browse the repository at this point in the history
…ned-detection

feat(scanned detection): Add support for XObject in scanned file detection
  • Loading branch information
awwaawwa authored Mar 9, 2025
2 parents ba8665b + dc5251c commit 45abc72
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion babeldoc/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.1.29"
__version__ = "0.1.30"
2 changes: 1 addition & 1 deletion babeldoc/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import subprocess
from pathlib import Path

__version__ = "0.1.29"
__version__ = "0.1.30"

CACHE_FOLDER = Path.home() / ".cache" / "babeldoc"

Expand Down
4 changes: 4 additions & 0 deletions babeldoc/document_il/midend/detect_scanned_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ def detect_page_is_scanned(page: il_version_1.Page, pdf: pymupdf.Document) -> bo
pdf.update_object(new_xref, "<<>>")
pdf.update_stream(new_xref, page.base_operations.value.encode("utf-8"))
pdf[page.page_number].set_contents(new_xref)

for xobj in page.pdf_xobject:
pdf.update_stream(xobj.xref_id, xobj.base_operations.value.encode("utf-8"))

after_page_image = pdf[page.page_number].get_pixmap()
after_page_image = np.frombuffer(after_page_image.samples, np.uint8).reshape(
after_page_image.height,
Expand Down
2 changes: 1 addition & 1 deletion babeldoc/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from babeldoc.translation_config import WatermarkOutputMode

logger = logging.getLogger(__name__)
__version__ = "0.1.29"
__version__ = "0.1.30"


def create_parser():
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "BabelDOC"
version = "0.1.29"
version = "0.1.30"
description = "Yet Another Document Translator"
license = "AGPL-3.0"
readme = "README.md"
Expand Down Expand Up @@ -133,7 +133,7 @@ pythonpath = [".", "src"]
testpaths = ["tests"]

[bumpver]
current_version = "0.1.29"
current_version = "0.1.30"
version_pattern = "MAJOR.MINOR.PATCH[.PYTAGNUM]"

[bumpver.file_patterns]
Expand Down

0 comments on commit 45abc72

Please sign in to comment.