GrapheneOS / PdfViewer

Simple Android PDF viewer based on pdf.js and content providers. The app doesn't require any permissions. The PDF stream is fed into the sandboxed WebView without giving it access to content or files. CSP is used to enforce that the JavaScript and styling properties within the WebView are entirely static.
https://grapheneos.org/
MIT License
599 stars 98 forks source link

Increase zoom range #84

Open ghost opened 3 years ago

ghost commented 3 years ago

Many common PDFs (with small page formats?) cannot be sufficiently enlarged to fit the screen, let alone zoomed into. An increase of the zoom range by a factor of 2, better 4, should fix this.

thestinger commented 3 years ago

We can support zooming out further but it's unrealistic to support zooming in further due to how much memory is used by HiDPI rendering.

ghost commented 3 years ago

I see, that is unfortunate. Perhaps an increase by a factor of 1.5 could still be implemented, given that the latest Pixels all have at least 6 GB of RAM. That would already help a lot.

Alternatively, a toggle could be added that increases the zoom range at the expense of available memory.

MHShetty commented 3 years ago

Do you want the PDF viewer's content to fit width by default?

schildbach commented 3 years ago

Any increase in "zoom in factor" would be welcome, even 1.5× (on top of the current max). Of the couple of PDFs I tried to read during the last weeks (e.g. festival timetables, covid certificates) not a single one was readable except for big titles etc.

Even a "digital zoom" (pixel based) would help. That way, the PDF doesn't need to be rendered at a higher resolution. Only the rendered output would be projected at the screen with a magnification.

zygfryd commented 2 years ago

So here's an anecdote about this issue. I went to a pharmacy today to get my digital prescription filled, it came in an e-mail in a PDF. I couldn't zoom in far enough to make it readable by a barcode scanner, or a regular pair of human eyes. Fear not, I did get my meds in the end, but the lack of fitness for its intended purpose of this mobile PDF Viewer was surprising.

Thanks for working on this issue, hope the fix gets merged soon.

PS. My PDF took less than 1/3 of the width of the screen in portrait when fully zoomed in. (Landscape didn't help zoom in further at all).

MDr164 commented 2 years ago

Got the same issue as the previous comment. For reading datasheets on the go it's sufficient but when I want to use the viewer to display digital train, expo or any sort of ticket that got a QR on it, it's always much too small for the reader to pick up the correct code. Right now my workaround is using MuPDF for tickets or anything with a QR or barcode on it and this viewer for regular text. I also didn't know zooming a PDF would eat that much memory honestly but as it's only important for things like a QR or barcodes in my opinion (human eyes are usually better at interpreting text than those digital readers) a pixel based zoom might suffice.

thestinger commented 2 years ago

The reason it uses a lot of memory is because we currently always use HiDPI rendering unlike most other PDF Viewers which are using scaling up pixels 2x or 4x. You should be able to see the difference from the appearance of the text compared to a lot of other ones. Using a sandboxed WebView instance with an internally sandboxed pdf.js instance also uses more memory than a whole bunch of memory unsafe C code.

We can implement support for zooming closer but not necessarily another 2x closer, only a bit. We can add support for zooming in even further based purely on scaling rather than rendering the whole page at higher resolution.

MDr164 commented 2 years ago

I think a toggle to allow zooming based on scaling is the most reasonable approach then. For me text is fine and those scanners surely wouldn't care about how they got the enlarged QR code. Anyways thanks for the effort of maintaining safe apps like this. Always appreciated to not need to install another app for something as displaying PDFs.

zygfryd commented 2 years ago

We can add support for zooming in even further based purely on scaling rather than rendering the whole page at higher resolution.

Thank you, I think that's indispensable.

EDIT: Let's take into account that Pixel screens are 400-500 PPI, you can zoom in 2x and it'd still be considered HiDPI, zoom in 4x and it's standard DPI. I think up to at least 8x bitmap scaling makes sense on screens like that, if it makes sense to render at full resolution in the first place.

dbr commented 2 years ago

We can add support for zooming in even further based purely on scaling rather than rendering the whole page at higher resolution

Personally I think this is a good compromise; when I've had trouble reading a PDF at the current maximum zoom, screenshotting it and zooming in with an image viewer resulted in perfectly legible text in the few cases I've tried

JakobKohler commented 2 years ago

We can support zooming out further but it's unrealistic to support zooming in further

Zooming out further would be great! I often get sent PDFs which are scans of documents (like Adobe Scan) and I can never see the entire page on screen because I can not zoom out enough

elesto commented 2 years ago

I really need more zooming for subway maps. This is fully zoomed. Screenshot_20220226-224405

thestinger commented 2 years ago

It's planned.

jaimet commented 2 years ago

London Underground ("Tube") map on max zoom:

Screenshot_20220911-142625

svrij commented 1 year ago

It's planned.

Just curious: any timeline known when higher scaling (zoom in not necessary for my practical use) will be implemented?

ViktorF commented 11 months ago

Just a quick reminder for this issue. I have encountered the same practical problem as zygfryd and MDr164 regarding barcode & qr code scanners several times this year. The scanners could never read the codes because I simply could not zoom in far enough. Which is really annoying when, for example, you are at an airport security checkpoint and the whole line is held up because of that. It got to the point where I considered installing a less secure PDF viewer for this purpose. In the end, I found a workaround of sorts: Take a screenshot of the pdf and zoom into the picture. But that is still a bit awkward and shows that it doesn't matter how high quality the zoom is. At least for this use case.

MDr164 commented 11 months ago

Just a quick reminder for this issue. I have encountered the same practical problem as zygfryd and MDr164 regarding barcode & qr code scanners several times this year. The scanners could never read the codes because I simply could not zoom in far enough. Which is really annoying when, for example, you are at an airport security checkpoint and the whole line is held up because of that. It got to the point where I considered installing a less secure PDF viewer for this purpose. In the end, I found a workaround of sorts: Take a screenshot of the pdf and zoom into the picture. But that is still a bit awkward and shows that it doesn't matter how high quality the zoom is. At least for this use case.

I switched to an insecure PDF viewer a long time ago and basically never use the builtin one because the only docs I open are either codes that need to be scanned or small text and neither is usable. The security is just not worth it for me if it fails its purpose.