PDF-1.6 格式的文档翻译报错 · Issue #1137 · PDFMathTranslate/PDFMathTranslate · GitHub
Skip to content

PDF-1.6 格式的文档翻译报错 #1137

Description

@PaiGack

在提问之前...

  • 我已经尝试了PDFMathTranslate-next,并在PDFMathTranslate-next提交了issue
  • 我已经搜索了现有的 issues
  • 我在提问题之前至少花费了 5 分钟来思考和准备
  • 我已经认真且完整的阅读了 wiki
  • 我已经认真检查了问题和网络环境无关(包括但不限于Google不可用,模型下载失败)

使用的环境

- os

PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"


- python: python 3.12

- pdf2zh:v1.9.11

请选择安装方式

pip

描述你的问题

PDF-1.6 格式的文档翻译报错

如何复现

  1. 执行 'pdf2zh ./data/document.pdf -t 128 -li en -lo zh -o output -s ollama:qwen3:8b'
  2. 出现问题
Traceback (most recent call last):
  File "/root/.local/bin/pdf2zh", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/root/.local/share/uv/tools/pdf2zh/lib/python3.12/site-packages/pdf2zh/pdf2zh.py", line 328, in main
    translate(model=ModelInstance.value, **vars(parsed_args))
  File "/root/.local/share/uv/tools/pdf2zh/lib/python3.12/site-packages/pdf2zh/high_level.py", line 383, in translate
    s_mono, s_dual = translate_stream(
                     ^^^^^^^^^^^^^^^^^
  File "/root/.local/share/uv/tools/pdf2zh/lib/python3.12/site-packages/pdf2zh/high_level.py", line 196, in translate_stream
    doc_en.save(stream)
  File "/root/.local/share/uv/tools/pdf2zh/lib/python3.12/site-packages/pymupdf/__init__.py", line 5601, in save
    mupdf.pdf_write_document(pdf, out, opts)
  File "/root/.local/share/uv/tools/pdf2zh/lib/python3.12/site-packages/pymupdf/mupdf.py", line 53759, in pdf_write_document
    return _mupdf.pdf_write_document(doc, out, opts)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pymupdf.mupdf.FzErrorSyntax: code=8: invalid key in dict
➜  /workspace git:(main) 

预期行为

能正常翻译 pdf

相关 Logs


原始PDF文件

No response

还有别的吗?

document.pdf

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions