mozilla / mozilla/pdf.js

[Bug]: PDF title displayed incorrectly when multiple language titles present in XMP metadata

Open
#20,801 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

core
Dominant language
JavaScript
Stars
53.9k
Forks
10.7k
Avg merge
18h 38m
Merged PRs (30d)
130

Description

Attach (recommended) or Link to PDF file

test.pdf

Web browser and its version

Firefox 149.0b4 (Developer Edition)

Operating system and its version

Arch Linux 6.18.13-zen1-1-zen

PDF.js version

5.5.207

Is the bug present in the latest PDF.js version?

Yes

Is a browser extension

Yes

Steps to reproduce the problem
  1. Create a PDF with a title with multiple languages in the XMP metadata.
    For example, the following LaTeX code in TeX Live 2026 produces the PDF attached above:
\DocumentMetadata{lang=en,debug={xmp-export}}
\documentclass{article}
\usepackage{hyperref}
\hypersetup{pdftitle={Hello World}}

\begin{document}
Hello World!
\end{document}

The produced PDF has the following XMP title metadata, with both x-default and en languages specified:

   <dc:title>
    <rdf:Alt>
     <rdf:li xml:lang="x-default">Hello World</rdf:li>
     <rdf:li xml:lang="en">Hello World</rdf:li>
    </rdf:Alt>
   </dc:title>
  1. Open the PDF using pdf.js.
  2. Open the Document Properties window in pdf.js.
What is the expected behavior?

The pdf.js Document Properties window displays the title for one language

What went wrong?

The properties window (and page title) concatenates the titles for all languages together:

Image

(The title here should just be "Hello World" rather than "Hello WorldHello World".)

Link to a viewer

No response

Additional context

Full XMP metadata from the attached PDF file (generated by LaTeX using \DocumentMetadata{debug={xmp-export}}):

test.xml

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by opening the attached test.pdf in pdf.js and checking the Document Properties window and page title with its XMP metadata. Trace how the multiple dc:title language entries are read and displayed. Done means a title with x-default and en entries is shown once rather than concatenated.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.