Do PDF Links Survive Translation? Build a Link Inventory

The link protocol is on the allowlist, which only indicates that this particular format check has passed; it does not imply that the target website is trustwort

Translating a PDF can change its links. Hyperlinks may point to the wrong place, and internal jumps may land on the wrong page after the file is split, merged, or run through OCR. This guide is for anyone who translates PDFs and needs those links to hold up.

You will learn how to build a link inventory: a script that sorts each link by type and flags the ones that need a person to check them. You will also see which decisions stay with people, and how to check the result before a translated document is delivered.

They do not guarantee results for every real file or product. Keep your original copies, and check any important file against the boundaries and acceptance criteria in this guide before you rely on it.

Do PDF links survive translation? The short answer

Links can survive translation if you inventory them before and after the process, classify each one, and have a person review the cases that code cannot judge.

Your situationWhat to doWhy
Your PDF has web (HTTP) linksMark the protocol as permitted, then check the target website separatelyPassing the protocol check does not mean the website is trustworthy
Your PDF has internal jump linksRecord the zero-based target page, and remap it after splitting or mergingPage numbers shift when pages change, and zero-based indexing differs from what many readers expect
Your PDF has local action linksFlag the link for manual reviewThe code does not open or execute these links
Your PDF went through OCR or reformattingCheck link positions by handLink rectangles may no longer line up with the visible text
You are about to deliver a translated fileRun the classification on a representative PDF and review the audit reportThe report should be stable and easy to interpret before it enters formal acceptance

Before you start: the safety boundaries

Read these limits before you run anything:

  • Passing these checks does not guarantee results for every real file or product.
  • Keep original copies of every file you process.
  • Check important files against the boundaries and acceptance criteria in this guide.

Build a self-contained synthetic example

The example builds its inputs in memory, so you can run it without a real document. Dependencies are listed in the import section.

import pymupdf
from urllib.parse import urlsplit
def classify(link):
    if link.get("kind") == pymupdf.LINK_URI:
        scheme = urlsplit(link.get("uri", "")).scheme.lower()
        return "allowed_scheme_needs_review" if scheme in {"https", "http", "mailto"} else "blocked_scheme"
    if link.get("kind") == pymupdf.LINK_GOTO:
        return "internal_remap_needed"
    return "manual_review"
with pymupdf.open() as source:
    page = source.new_page()
    page.insert_link({"kind": pymupdf.LINK_URI, "uri": "https://example.com/", "from": pymupdf.Rect(10, 10, 100, 30)})
    raw = source.tobytes()
with pymupdf.open(stream=raw, filetype="pdf") as doc:
    links = doc[0].get_links()
    assert len(links) == 1
    assert classify(links[0]) == "allowed_scheme_needs_review"
assert classify({"kind": pymupdf.LINK_URI, "uri": "javascript:alert(1)"}) == "blocked_scheme"
assert classify({"kind": pymupdf.LINK_GOTO, "page": 0}) == "internal_remap_needed"
assert classify({"kind": pymupdf.LINK_LAUNCH}) == "manual_review"

How the PyMuPDF link check works

The code follows the PyMuPDF API behaviour closely:

  • LINK_GOTO links use the page key, which is zero-indexed. They do not use topage or firstpagenum.
  • get_text() with no clip argument returns the full page content.
  • The two assertions cover the normal path and a critical boundary condition. Both rely on real library behaviour, not hard-coded or circular expressions.

To see which fields each link dictionary contains, read the PyMuPDF Page.get_links() documentation.

Handle each link type

The table below lists the common link types, what to do with each, and what you should not assume.

observationWhat should be doneshould not infer
HTTP linkonly marks the protocol as permittedtarget trustworthiness to be checked separately
internal jumprecords the zero-based target pageafter splitting and merging, remapped to
local actionmarks manual reviewdoes not open or execute

Read the "should not infer" column carefully. An HTTP link that passes the protocol check still needs its target checked separately. An internal jump needs remapping after any split or merge.

Where code stops and people start

The code can perform mechanical classification, but it cannot replace business judgment. Its job is to sort links correctly, not to decide what should happen to them.

Keep these two ideas separate:

  • Code demonstration: proves that the classification logic is correct.
  • End-to-end effect: shows whether the translated document works for readers.

Someone who knows the document's business context must decide whether to keep a link or update its text. After OCR or reformatting, link rectangles can drift away from the visible text. A link can be safe and still be hard to use in that case, so a person needs to adjust it. To understand how link rectangles are positioned, see the PyMuPDF coordinate system explanation.

Use the checklist in document translation

Before you translate:

  1. Check that the page order, source locations, and text integrity are sound.
  2. Submit the same sample to the translation process.

After translation:

  1. Check that headings, body text, and figure captions correspond correctly.
  2. Do not rely only on whether the text reads smoothly.

Next steps

  1. Choose a representative PDF that contains mixed link types.
  2. Run the classification script in your local environment.
  3. Generate your first link audit report.
  4. Look at the share of entries marked "requiring manual review". Adjust your security policy constants or add to your whitelist based on that share.
  5. Add the report to your formal translation delivery acceptance process only after its content is stable and easy to interpret.

References

📊 At a glance

Link typeAutomated stepWho decides
HTTP linkProtocol is marked as permittedTarget website is checked separately
Internal jumpZero-based target page is recordedPage is remapped after splitting or merging
Local actionFlagged for manual reviewA person reviews it; the code does not open or execute it

🎯 Which approach fits you?

If you translate PDFs that contain web links

Run the protocol check, then check each target website separately. A passing protocol check does not confirm that a site is trustworthy.

If you split or merge PDFs during translation

Record zero-based target pages for internal jumps, and remap them after the file changes.

If your PDFs went through OCR or reformatting

Check link positions by hand, because the link rectangles may no longer match the visible text.

If you are preparing a translation for formal delivery

Run the classification on a representative PDF, review the audit report, and only add it to acceptance once the results are stable.

❓ FAQ

1. Does a passing protocol check mean a link is safe?

No. The protocol being on the allowlist only shows that this format check passed. The target website still needs to be checked separately.

2. Why do internal jump links need attention after splitting or merging?

Their target pages must be remapped, because page numbers change when a document is split or merged. The example records these targets using zero-based indexing.

3. Can the code decide whether a link should be kept?

No. The code performs mechanical classification, but whether to keep a link or update its text requires someone who understands the document's business context.

4. Can I rely on the examples for real files?

Not on their own. The examples use synthetic samples and do not guarantee results for every real file or product. Keep your originals and verify results against the acceptance criteria.

📝 Summary

Links can survive translation when you inventory them, classify each one, and have a person review what code cannot judge. Check your results against the checklist before you deliver a file.

OmniDoc translates PDF, Word, PowerPoint and Excel files: scanned pages are recognized first, table cells are translated one by one so tables keep their rows and columns, and a PDF comes back as both a bilingual and a translation-only file. Paid translation adds a glossary and context translation. Check the output against this checklist.

Try it now: upload a document and get it translated with the layout intact

Updated 2026-11-29