Skip to content

Commit 4be345d

Browse files
authored
Merge pull request #195 from funstory-ai/pdf2zh-v2-rc
fix: Fix form ctm matrix
2 parents d84e683 + 0e4e5b2 commit 4be345d

File tree

6 files changed

+13
-12
lines changed

6 files changed

+13
-12
lines changed

babeldoc/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.2.19"
1+
__version__ = "0.2.20"

babeldoc/const.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import subprocess
44
from pathlib import Path
55

6-
__version__ = "0.2.19"
6+
__version__ = "0.2.20"
77

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

babeldoc/document_il/backend/pdf_creater.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -673,12 +673,13 @@ def write(self, translation_config: TranslationConfig) -> TranslateResult:
673673
}
674674
page_op = BitStream()
675675
# q {ops_base}Q 1 0 0 1 {x0} {y0} cm {ops_new}
676-
page_op.append(b"q ")
676+
# page_op.append(b"q ")
677677
page_op.append(page.base_operations.value.encode())
678-
page_op.append(b" Q ")
679-
page_op.append(
680-
f"q Q 1 0 0 1 {page.cropbox.box.x} {page.cropbox.box.y} cm \n".encode(),
681-
)
678+
page_op.append(b" \n")
679+
# page_op.append(b" Q ")
680+
# page_op.append(
681+
# f"q Q 1 0 0 1 {page.cropbox.box.x} {page.cropbox.box.y} cm \n".encode(),
682+
# )
682683
# 收集所有字符
683684
chars = []
684685
# 首先添加页面级别的字符

babeldoc/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from babeldoc.translation_config import WatermarkOutputMode
2424

2525
logger = logging.getLogger(__name__)
26-
__version__ = "0.2.19"
26+
__version__ = "0.2.20"
2727

2828

2929
def create_parser():

babeldoc/pdfinterp.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ def do_Do(self, xobjid_arg: PDFStackT) -> None:
290290
self.scs = interpreter.scs
291291
self.il_creater.on_xobj_end(
292292
x_id,
293-
f"q {ops_base}Q {a} {b} {c} {d} {e} {f} cm ",
293+
f"q {ops_base} Q {a} {b} {c} {d} {e} {f} cm ",
294294
)
295295
try: # 有的时候 form 字体加不上这里会烂掉
296296
self.device.fontid = interpreter.fontid
@@ -345,7 +345,7 @@ def process_page(self, page: PDFPage) -> None:
345345
# )
346346
# for obj in page.contents:
347347
# self.obj_patch[obj.objid] = ""
348-
return ops_base
348+
return f"q {ops_base} Q 1 0 0 1 {x0} {y0} cm"
349349

350350
def render_contents(
351351
self,

pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "BabelDOC"
3-
version = "0.2.19"
3+
version = "0.2.20"
44
description = "Yet Another Document Translator"
55
license = "AGPL-3.0"
66
readme = "README.md"
@@ -148,7 +148,7 @@ pythonpath = [".", "src"]
148148
testpaths = ["tests"]
149149

150150
[bumpver]
151-
current_version = "0.2.19"
151+
current_version = "0.2.20"
152152
version_pattern = "MAJOR.MINOR.PATCH[.PYTAGNUM]"
153153

154154
[bumpver.file_patterns]

0 commit comments

Comments
 (0)