Before you submit
Environment
- OS: MacOS Tahoe 26.4.1
- Python: Python 3.13.3
- BabelDOC: Latest Version
Describe the bug
I try to translate this PDF DGA.pdf
Using this command and got some issues below
uv run babeldoc --openai --openai-model "gemini-2.5-flash" --openai-base-url "xxx" --openai-api-key "xxx" --files ../DGA.pdf
Overlap issue
The translated text output for the first page is overlapped
Text in one line issue
The text should be separated into different lines, but it is merged into 1 line
Steps to Reproduce
- Clone repository
- Run command uv run babeldoc --openai --openai-model "gemini-2.5-flash" --openai-base-url "xxx" --openai-api-key "xxx" --files ../DGA.pdf
- See error on the output PDF
Expected Behavior
- The translated text shouldn't overlap
- The multiline text shouldn't be merged into 1 line
Relevant Log Output or Screenshots
05/13/26 13:08:32] INFO INFO:babeldoc.format.pdf.document_il.midend.automatic_term_extractor:Automatic Term Extraction: Starting term extraction for automatic_term_extractor.py:358
document.
INFO INFO:babeldoc.format.pdf.document_il.midend.automatic_term_extractor:Using 4 worker threads for automatic term extraction. automatic_term_extractor.py:369
[05/13/26 13:08:55] INFO INFO:babeldoc.format.pdf.document_il.midend.il_translator_llm_only:Found title paragraph: Dietary GuidelinesFor Americans il_translator_llm_only.py:171
INFO INFO:babeldoc.format.pdf.document_il.midend.il_translator_llm_only:Found first title paragraph: Dietary GuidelinesFor Americans il_translator_llm_only.py:192
[05/13/26 13:09:05] WARNING WARNING:babeldoc.format.pdf.document_il.midend.il_translator_llm_only:Translation result is the same as input, fallback. il_translator_llm_only.py:778
WARNING WARNING:babeldoc.format.pdf.document_il.midend.il_translator_llm_only:Fallback to simple translation. paragraph id: HaeR7 il_translator_llm_only.py:828
WARNING WARNING:babeldoc.format.pdf.document_il.midend.il_translator_llm_only:Translation result is the same as input, fallback. il_translator_llm_only.py:778
WARNING WARNING:babeldoc.format.pdf.document_il.midend.il_translator_llm_only:Fallback to simple translation. paragraph id: jF1Wj il_translator_llm_only.py:828
[05/13/26 13:09:42] INFO INFO:babeldoc.format.pdf.document_il.midend.il_translator_llm_only:Translation completed. Total: 139, Successful: 137, Fallback: 2 il_translator_llm_only.py:255
[05/13/26 13:09:46] INFO INFO:babeldoc.format.pdf.document_il.backend.pdf_creater:Font subsetting completed successfully pdf_creater.py:1194
[05/13/26 13:09:48] INFO INFO:babeldoc.format.pdf.document_il.backend.pdf_creater:PDF save with clean=True completed successfully pdf_creater.py:1309
[05/13/26 13:09:51] INFO INFO:babeldoc.format.pdf.document_il.backend.pdf_creater:PDF save with clean=True completed successfully pdf_creater.py:1309
INFO INFO:babeldoc.format.pdf.high_level:Peak memory usage: 1295.77 MB high_level.py:351
INFO INFO:babeldoc.format.pdf.high_level:finish translate: ../DGA.pdf, cost: 85.76081681251526 s high_level.py:628
INFO INFO:babeldoc.format.pdf.high_level:No TOC found in the original PDF, skipping migration. high_level.py:694
translate ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100/100 0:01:25 0:00:00
INFO INFO:babeldoc.main:Translation results: main.py:754
Original PDF: ../DGA.pdf
Total time: 85.76 seconds
INFO INFO:babeldoc.main:Prompt tokens: 45257 main.py:764
INFO INFO:babeldoc.main:Completion tokens: 14237 main.py:765
INFO INFO:babeldoc.main:Cache hit prompt tokens: 0 main.py:766
INFO INFO:babeldoc.main:Term extraction tokens: total=15746 prompt=9459 completion=6287 cache_hit_prompt=0 main.py:769
INFO INFO:babeldoc.format.pdf.high_level:Waiting for translation to finish... high_level.py:315
INFO INFO:babeldoc.format.pdf.translation_config:cleanup temp files: /var/folders/_q/rblpsyhx4g17l9dryg5nhlb80000gn/T/tmp2u3sgh88 translation_config.py:472
Original PDF File
DGA.pdf
Additional Context
I have tried many different config like --figure-table-protection-threshold 1, --split-short-lines --short-line-split-factor 0.6, --disable-rich-text-translate, --min-text-length 3, --enable-json-mode-if-requested but it still got error on the output pdf
Before you submit
Environment
Describe the bug
I try to translate this PDF DGA.pdf
Using this command and got some issues below
Overlap issue
The translated text output for the first page is overlapped
Text in one line issue
The text should be separated into different lines, but it is merged into 1 line
Steps to Reproduce
Expected Behavior
Relevant Log Output or Screenshots
Original PDF File
DGA.pdf
Additional Context
I have tried many different config like
--figure-table-protection-threshold 1,--split-short-lines --short-line-split-factor 0.6,--disable-rich-text-translate,--min-text-length 3,--enable-json-mode-if-requestedbut it still got error on the output pdf