mozilla / pdf.js

PDF Reader in JavaScript
https://mozilla.github.io/pdf.js/
Apache License 2.0
48.01k stars 9.93k forks source link

Magazine PDF with side-by-side pages renders off-screen #9359

Closed dalin- closed 2 years ago

dalin- commented 6 years ago

Attach (recommended) or Link to PDF file here: https://www.aclu.org/sites/default/files/field_document/aclu_stand_mag_summer_2015.pdf

Configuration:

Steps to reproduce the problem:

  1. Use the PDF viewer embedded here: https://www.aclu.org/other/read-latest-issue-stand The cover page will show auto zoom (and I think it is choosing fit-width).
  2. Scroll down to the next page (other than the cover, all pages are side-by-side). Odd pages are rendered off-screen.

image

What is the expected behavior? (add screenshot)

If you play around with opening the PDF viewer sidebar and choosing individual pages and/or switching between Automatic Zoom and Page Width, you can get into a state where the cover page is on its own, but subsequent pages are side-by-side. See screenshots.

image

image

I'm trying to make this the default state when opening the PDF. I've been playing around with the viewer options. The closest that I've gotten is #page=2&zoom=page-fit,0,1100 which results in this:

image

So close..., but if I add any more top offset it goes back to looking like the original screenshots.

Link to a viewer (if hosted on a site other than mozilla.github.io/pdf.js or as Firefox/Chrome extension): https://www.aclu.org/other/read-latest-issue-stand

I'm not sure if this is a bug, or just some hidden configuration value that I don't know about.

brendandahl commented 6 years ago

I haven't looked to deeply yet, but I think it's because we base page-fit off the size of the first page. We could probably do something smarter and look at subsequent page sizes.

dalin- commented 6 years ago

So that I can go back to my client with the full range of possible options, does this project have a bug bounty program? Formal or otherwise? The only other offer of a bounty that I could find is https://github.com/mozilla/pdf.js/issues/2594#issuecomment-232006047 And it's not clear whether or not the bounty was actually claimed.

brendandahl commented 6 years ago

There's no formal bug bounty program. I do believe the one you referenced above was claimed though.

brendandahl commented 6 years ago

Somewhat off topic... I'm not sure what the intentions of the above site, but if it's purely for viewing the PDF online, you (or your client) may want to export that PDF as a PDF optimized for the web. It looks like some of the images in it have a really high DPI and could be much smaller if it only needs to be shown online.

dalin- commented 6 years ago

Thanks for your thoughts. The current plan is to modify the PDF, and see how that works.

Snuffleupagus commented 2 years ago

Duplicate of #5628