Am 23.09.22 um 02:47 schrieb Max Chernoff:
I compiled a kind of wishlist what we need or look for in a new or enhanced open source PDF viewer, as discussed e.g. at the 2021 meeting.
https://wiki.contextgarden.net/PDF_viewer
Feel free to enhance the wiki page or discuss here.
I think that pdf.js (the Firefox PDF viewer) meets most of these requirements. There are a few requirements that it doesn't meet, but it's open source and written in JavaScript, so we should be able to add anything that's missing.
You’re right, pdf.js is quite good, and it’s already used by a lot of projects (browsers, editor plugins etc.) – the latter also means that you often encounter old/buggy/limited versions. Unfortunately, Firefox doesn’t register itself as a PDF viewer (at least on MacOS), that means I can’t use it easily to open a PDF from the command line (e.g. in scripts). But anyway, that could shift our focus to add/enable features for pdf.js in TeX editors.
- PDF 2.0 compatible
It can open PDF 2.0 files, but I doubt that it supports every single feature.
I won’t expect every feature, there are too many. Actually I don’t know which features of PDF 2.0 Hans was missing in viewers.
- proper color and transparency display (respect color profiles)
It supports all of the PDF colour models/profiles for vectors, although it ignores embedded colour profiles in images.
https://github.com/mozilla/pdf.js/issues/2856
Regular RGB and CMYK stuff works fine though.
That’s a problem if you prepare PDFs for printing. Apple’s PDF library (used e.g. in Preview.app, Skim, TeXshop) also does a bad job at it, as well as Sumatra and Chrome (according to the comments to that ticket).
- limited JavaScript support (no modification, no file operations)
Yes, although it is quite limited:
https://blog.mozilla.org/attack-and-defense/2021/10/14/implementing-form-fil...
Thank you for the link! What they write about the scope of JS in pdf.js sounds good; but presentation stuff like buttons (e.g. for OCG) is probably missing. I need to check the limits of forms in pdf.js; but Mozilla even implemented XFA (e.g. Qoppa didn’t).
- update on file change (configurable)
Not by default in Firefox. It works fine in this extension though:
There it’s probably the editor framework that enables refresh. (Same experience with pdf.js in Atom.)
- SyncTeX support
Not in Firefox, although there are patches to enable it:
https://github.com/James-Yu/LaTeX-Workshop/blob/cff1a372/viewer/components/s... https://github.com/tomoki1207/vscode-pdfviewer/blob/92fecdb8/src/pdfPreview....
One of the Atom plugins was supposed to have it, but it didn’t work... (SyncTeX with ConTeXt is special anyway, we need to look into that again.)
- accessibility (e.g. alternative text must work)
I've never used it, but it looks like there's good support:
https://blog.mozilla.org/attack-and-defense/2021/10/14/implementing-form-fil...
Sounds good.
- JS for controlling optional content groups (OCGs, Viewer Layers)
You can toggle all the layers in the side panel. I don't think that you can toggle via buttons or JS though.
Same as in Okular. OCG control via JS would enable stepwise presentations and simple animations.
- inner- and inter-document links must work
Yes; however, inter-document links are sometimes limited depending for security reasons. I'm sure that this can be configured though.
Of course; I just meant it would be handy to be able to jump between PDFs in the same directory.
- multimedia support at least via links (suggestion: use “plain Rich Media” approach with OS’ default player)
I don't think so, although I guess you could include a video file as an attachment.
A question for Michal...
- transition effects not necessary (but if the developer has fun including them, go on)
No transition effects.
for forms: - fill in Yes.
Just checked again with current Firefox: It doesn’t work with all of my test files.
- print documents with/without form contents Yes.
I couldn’t find an option to print without form contents. (But usually you would want filled forms, so “with” is ok.)
- same-ID fields on different pages must be synchronized
No idea.
If the form generally works, this does also. I listed it because it’s a problem in some viewers.
- custom checkmarks/radiobuttons should work & display correctly
Usually it works, sometimes it doesn't.
- JS for calculations
Usually it works, sometimes it doesn't.
Need to check further...
for annotations (correction workflow; generally just nice to have): - similar to Adobe/Foxit Reader
Reading annotations works, but you can't modify anything.
Ok. There’s still no PDF viewer on Linux that can handle annotations well. (But even Acrobat Reader on MacOS frequently crashes on them; I’m using Foxit Reader for annotations, but the one for Linux is too old.)
for development/debugging: - show metadata (incl. XMP), e.g. in a sidebar or dialog
You can see all the "regular" metadata, but XMP doesn't work.
That should be easy to add, since pdf.js can handle Tagged PDF (XML parser included).
- show fonts metadata (inclusion etc.) No.
Pity. Should also not be too difficult, since the viewer needs the data anyway.
- show PDF Boxes (MediaBox, CropBox, TrimBox, BleedBox, ArtBox) as colored frames, switchable via preferences and menu (bar) item No.
Of course. There’s no viewer except Adobe Reader that shows these. But it’s an important feature for print preparation and should be easy to implement.
- Funding Overleaf uses pdf.js as its default PDF viewer, so they may perhaps be willing to help.
At least with SyncTeX support and other closely TeX-related stuff.
I've been using pdf.js almost exclusively for the past few years either via Firefox or VS Code, and I've never really had any problems. The only real issue that I've had is that it gets fairly slow with documents over a few thousand pages long. Otherwise, it seems pretty fast and stable, and it supports nearly every feature that I tend to need.
Well, documents with thousands of pages are probably unreliable/slow in most viewers.
Since it's written in JavaScript, it should be fairly easy to modify, and it should run on nearly everything.
Thank you! Hraban