mozilla / mozilla/pdf.js

[Feature]: Zoom modes "Content Fit"/"Content Width"

Open
#20,574 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

feature requires-feedback-from-ux-ui viewer
Dominant language
JavaScript
Stars
53.9k
Forks
10.7k
Avg merge
18h 38m
Merged PRs (30d)
130

Description

Is the feature relevant to the Firefox PDF Viewer?

Yes

Feature description
What

Similar to the zoom modes "Page Fit" and "Page Width", I'd like to have modes that zoom to the content of the PDF, automatically cropping (most of) the (typically white) margins.

Why

This would be useful in settings where screen real estate is scarce, eg. when using PDF.js in any sort of split screen/window tiling configuration, on mobile, etc. I know this particular use case is very rare, but I am an Obsidian user who uses it to view PDFs with internal links, and they have hover previews. If those previews were cropped to the content, they would be way more useful.

Alternatives/Workarounds

Currently, I have to zoom in manually, which oftentimes is quite tedious to get just right. The proposed marquee zoom (#1260) would yield an improvement in this use case.

Other PDF viewers

KOReader has this feature, although the scope and usecase of KOReader is quite different to PDF.js (it is primarily meant to run on e-readers). Link to documentation

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 in the Firefox PDF Viewer by reviewing the existing “Page Fit” and “Page Width” zoom modes and the proposed marquee zoom issue (#1260). Clarify how PDF content bounds and margins should be detected, including difficult documents, then define and test “Content Fit” and “Content Width” behavior for split-screen, mobile, and hover-preview use cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.