ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Henning Hraban Ramm via ntg-context <ntg-context@ntg.nl>
To: ntg-context@ntg.nl
Cc: Henning Hraban Ramm <texml@fiee.net>
Subject: Re: PDF viewer
Date: Fri, 23 Sep 2022 09:59:43 +0200	[thread overview]
Message-ID: <efa22392-2349-b11c-0007-9d39708ea342@fiee.net> (raw)
In-Reply-To: <47d2595c6cd444c92eea9410c57e762bd3fd737a.camel@telus.net>

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-filling-and-accessibility-in-the-firefox-pdf-viewer/

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:
> 
>     https://github.com/tomoki1207/vscode-pdfviewer

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/synctex.ts
>     https://github.com/tomoki1207/vscode-pdfviewer/blob/92fecdb8/src/pdfPreview.ts

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-filling-and-accessibility-in-the-firefox-pdf-viewer/

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

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

  parent reply	other threads:[~2022-09-23  7:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-22 18:07 Henning Hraban Ramm via ntg-context
2022-09-23  0:47 ` Max Chernoff via ntg-context
2022-09-23  2:30   ` Alan Braslau via ntg-context
2022-09-23  7:59   ` Henning Hraban Ramm via ntg-context [this message]
2022-09-23 10:18     ` Max Chernoff via ntg-context
2022-09-23 15:56       ` Pablo Rodriguez via ntg-context
2022-09-23 15:34     ` Bruce Horrocks via ntg-context
2022-09-25 15:24   ` juh via ntg-context
2022-09-25 16:41     ` Pablo Rodriguez via ntg-context
2022-09-23  9:52 ` luigi scarso via ntg-context
2022-09-23 15:23 ` Pablo Rodriguez via ntg-context
2022-09-26 14:44   ` Willi Egger via ntg-context
2022-09-26 17:15     ` Pablo Rodriguez via ntg-context

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=efa22392-2349-b11c-0007-9d39708ea342@fiee.net \
    --to=ntg-context@ntg.nl \
    --cc=texml@fiee.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).