Skip to content

[Bug]: ghostscript rewritten PDFs show fonts incorrectly in pdf.js #20633

@brianclinkenbeard

Description

@brianclinkenbeard

Attach (recommended) or Link to PDF file

https://github.com/user-attachments/files/23527111/main__compressed.pdf

Web browser and its version

Firefox 147.0.1

Operating system and its version

Fedora Linux 43

PDF.js version

5.4.445

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

Yes

Is a browser extension

No

Steps to reproduce the problem

  1. Generate a document with LuaTeX or typst (font I used: TeX Gyre Pagella)
  2. Run the file through ghostscript. For me this looks like: gs -dPrinted=false -sDEVICE=pdfwrite -o output.pdf input.pdf
  3. pdf.js shows text incorrectly and elongates characters. Please see this issue for examples: Running typst pdf output through ghostscript breaks fonts typst/typst#7373
    The rewritten file does not appear incorrectly in Okular.

What is the expected behavior?

pdf.js shows text correctly and does not elongate characters

What went wrong?

Correct original / ghostscript rewritten viewed in other viewers like Okular:
Image

pdf.js:
Image

Link to a viewer

No response

Additional context

Tested and issue occurs on latest git master as well. Setting browser.display.use_document_fonts to 0 in Firefox is a workaround.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions