From ae573e225569fafb0bb8685f5ea7b3fe38818c53 Mon Sep 17 00:00:00 2001 From: 7shi <7shi@live.jp> Date: Sun, 22 Dec 2024 02:45:44 +0900 Subject: [PATCH] fix: save document stream before translation to ensure proper processing --- pdf2zh/high_level.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pdf2zh/high_level.py b/pdf2zh/high_level.py index 2b654583..e5eea232 100644 --- a/pdf2zh/high_level.py +++ b/pdf2zh/high_level.py @@ -206,6 +206,8 @@ def translate_stream( font_list.append(("china-ss", None)) doc_en = Document(stream=stream) + stream = io.BytesIO() + doc_en.save(stream) doc_zh = Document(stream=stream) page_count = doc_zh.page_count # font_list = [("china-ss", None), ("tiro", None)]