Language Tagging in PDFs — Complete Guide
In this tutorial, you will learn about Language Tagging in PDFs. We cover key concepts, practical examples, and best practices to help you master this topic.
Language tagging in PDF Accessibility means declaring the document's primary language in the metadata and marking any section where the language changes, so that screen readers apply the correct pronunciation rules, character sets, and voice profiles.
What You'll Learn
You will learn how to set the default document language in Acrobat, how to mark inline language changes for multilingual content, how to verify language properties, and how screen readers use language information for speech synthesis.
Why It Matters
Screen readers use language metadata to select the correct voice and pronunciation engine. If a PDF contains French phrases but is tagged as English, the screen reader pronounces French words using English phonetics, producing gibberish.
Real-World Use
An international organization publishes a bilingual report with English main content and Spanish quotes. The document language is set to en-US. Spanish phrases like "muchas gracias" are pronounced with English rules ("muh-chas gra-see-us"). After marking each Spanish span with the lang="es" attribute, the screen reader switches to Spanish pronunciation for those sections.
Language Hierarchy
flowchart TD A["Document Catalog lang=en"] --> B["Page 1 lang=en"] B --> C["Paragraph lang=en"] C --> D["Inline Spanish: lang=es"] B --> E["Inline French: lang=fr"] A --> F["Page 2 lang=en"] F --> G["Table with lang=en"] A --> H["Page 3 lang=de"] H --> I["German content"]
Setting Document Language
In Acrobat Pro
- File > Properties > Description tab.
- In the Language field, select or type the language code (e.g.,
en-US,fr-FR,es-ES). - Click OK.
Programmatically
# Set document language using pdfplumber
import pdfplumber
with pdfplumber.open("document.pdf") as pdf:
# Check current language
current_lang = pdf.metadata.get("language")
print(f"Current language: {current_lang}")
// Acrobat JavaScript to set document language
this.info.Language = "en-US";
console.println("Language set to " + this.info.Language);
Marking Language Changes
When a section of content switches to a different language, you must tag that content with the correct language attribute:
- In the Tags panel, find the content element (P, Span, etc.) that contains the foreign language text.
- Right-click > Properties > Tag tab.
- In the Language field, enter the language code (e.g.,
frfor French). - Click Close.
For inline phrases within a paragraph, wrap the foreign text in a <Span> tag with the language attribute:
Tag tree:
<P> The meeting ended with a resounding
<Span lang="fr">"Merci à tous"</Span>
from the CEO.
</P>
Language Code Format
Use BCP 47 language tags:
| Language | Code | Example |
|---|---|---|
| English (US) | en-US | "Hello" |
| English (UK) | en-GB | "Colour" |
| Spanish | es | "Gracias" |
| French | fr | "Merci" |
| German | de | "Danke" |
| Chinese (Simplified) | zh-CN | "谢谢" |
| Arabic | ar | "شكرا" |
| Hindi | hi | "धन्यवाद" |
Common Mistakes
Language set to "None" or "Unspecified" — Screen readers may default to guessing, which produces wrong pronunciation for many documents.
Only setting page content language but missing inline changes — A single foreign word in an English paragraph needs its own language tag on a
<Span>.Using three-letter codes — PDF/UA expects BCP 47 codes (
en, noteng). Some older tools generate three-letter codes that screen readers may not recognize.Forgetting to set language in the document catalog — Setting language on individual tags without setting the document default means screen readers may not know the primary language.
Inconsistent language codes — Using
enin one place anden-USelsewhere is technically fine but inconsistent. Pick one pattern for the document.
Practice and Challenge
- Where is the document-level language set in Acrobat Pro?
- What BCP 47 language code should you use for French as spoken in Canada?
- How do you mark a single Spanish word within an English paragraph?
- What happens when a screen reader encounters content with no language tag?
- How do you verify the language attribute in the tag tree?
Challenge: Create a 2-page PDF with English content that includes at least three foreign language phrases (e.g., a French quote, a Spanish term, and a German company name). Set the document language to English, then mark each foreign phrase with the correct language tag. Verify with a screen reader that each phrase is pronounced correctly.
FAQ
Mini Project
Take a 3-page PDF document that includes at least 5 foreign language phrases (use Wikipedia articles or translate parts of a document). Correctly tag the document language and each foreign phrase. Export the tag tree and verify that each language change is marked. Test with a screen reader.
What's Next
Continue to Color Contrast in PDFs to learn how to ensure sufficient color contrast in PDF documents, then proceed to PDF Tools — Acrobat, pa11y-pdf.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro