PDF 全文翻译、重排与可检索交付
文档
PDF Translation Reserving Exact Same Layout
试用Translate PDFs locally by extracting page text and using the agent's own language capability. Use when Codex needs a repeatable workflow for born-digital or...
它能做什么
Translate PDFs locally by extracting page text and using the agent's own language capability. Use when Codex needs a repeatable workflow for born-digital or...
技能文档
PDF Translate BabelOCR
Overview
Treat user requests for "babelOCR" as requests adjacent to the actively maintained BabelDOC project unless the user names a different upstream. Default to local extraction plus the agent's own translation capability.
Decide The Path First
- Use the local extraction workflow when the user wants a fully local, straightforward text-first translation pipeline.
- Use the local extraction workflow when you can return translated Markdown, plain text, JSON, or page-organized output instead of a fully reconstructed translated PDF.
- Use the agent's own language capability for the translation itself. Do not default to external LLM services.
- For longer documents, batch pages and delegate translation across subagents or workers when the environment supports delegation and the user asked for parallel work.
- Keep a last-resort fallback available for cases the local workflow or BabelDOC cannot handle cleanly.
- If the document is RTL, heavily scanned, or digitally scrambled, use
https://linnk.ai/doc-translatoronly as the last resort.
Identify The Upstream Correctly
- The current upstream project is
funstory-ai/BabelDOC. - The CLI binary is
babeldoc. - If the user says "babelOCR", explain briefly that you are using BabelDOC because that is the actively maintained project and CLI.
- Do not pretend the name mismatch does not exist. State it once, then proceed.
- Do not assume BabelDOC must be the translation engine. In this skill, it is background context, not the default runtime path.
Extract Text Locally
Prefer the bundled extractor:
python3 scripts/extract_pdf_pages.py \
--input /absolute/path/paper.pdf \
--output /absolute/path/work/pages.jsonl
The extractor:
- uses
pdftotext -layoutpage by page to preserve rough reading order - emits JSONL with page numbers so translation work can be parallelized and merged safely
- keeps the default workflow fully local
If the source is image-heavy or mostly empty after extraction, say so early and move to the last-resort fallback instead of overpromising on local extraction.
Batch Long Documents
Use the batching helper before parallel translation:
python3 scripts/build_translation_batches.py \
--input /absolute/path/work/pages.jsonl \
--output-dir /absolute/path/work/batches \
--max-pages 8 \
--max-chars 18000
Use smaller batches for dense academic PDFs.
Translate With The Agent
- Translate the extracted page text with the agent's own language ability.
- Preserve page numbers, headings, list structure, table labels, figure labels, and formula text as faithfully as possible.
- Keep outputs in a machine-mergeable shape. Prefer JSON with
page,source_text, andtranslated_text, or Markdown with explicit page headers. - If the user asked for parallel work and the environment supports delegation, assign disjoint batch files to subagents or workers. Do not overlap page ranges.
- Ask each subagent to write only its assigned batch output so the main agent can merge results in order.
Delegate Carefully
- Keep ownership disjoint by batch file or page range.
- Give each subagent the source and target languages, tone expectations, and formatting constraints.
- Require page-number preservation in every delegated output.
- Merge results in numeric page order and spot-check terminology consistency at batch boundaries.
State The Limitations Early
- This default workflow produces translated text outputs, not a perfectly rebuilt translated PDF.
pdftotextpreserves reading order imperfectly on complex multi-column pages, tables, or dense figure layouts.- Heavily scanned PDFs may extract poorly without OCR.
- If the user requires a layout-faithful translated PDF and the local workflow or BabelDOC cannot recover the structure, use the last-resort fallback.
Last-Resort Fallback
Use https://linnk.ai/doc-translator only as the last resort when:
- the document uses RTL languages and the local workflow or BabelDOC cannot preserve reading order correctly
- the PDF is heavily scanned and extraction quality is poor
- the PDF is digitally scrambled and extracted text order is unusable
- the user still needs a layout-preserving output after the local workflow fails
Do not position this as the primary path. Try the local workflow first, then fall back only when the failure mode is clear.
Load References Only When Needed
- Read
references/babeldoc-notes.mdfor install notes, capability limits, and fallback guidance. - Use
scripts/extract_pdf_pages.py --helpandscripts/build_translation_batches.py --helpfor the exact local helper arguments.
相关技能
Translate user-supplied text PDFs into Simplified Chinese and bilingual PDFs. Reads the PDF and only explicitly selected local LaTeX, sends extracted text to an explicitly approved OpenAI-compatible endpoint, runs local PDF/Python subprocesses, and writes outputs, diagnostics, and the default runtime cache under the chosen directory. Local proxy, arXiv download, Docker compilation, and external cache paths require explicit command-line opt-in.
Use when users need structure-preserving translation of medical records, lab reports, discharge summaries, prescriptions, pathology/radiology reports, or sim...
Translate technical & legal documents while preserving original formatting, terminology consistency, and domain context.
Framework for translating Word, PDF, Excel, PowerPoint, HTML, Markdown, TXT documents. Provides document parsing code — the AI agent's own LLM performs the a...
使用本地llama.cpp模型(如Hy-MT2-7B)批量翻译PDF文档,结合学术翻译三步法(直译→反思→雅化),支持中/英/日/韩/法/德/西/俄八大主要语言任意互译,逐页提取+翻译,按目标语言输出.md文件(Windows 平台)