Created attachment 196805 [details]
Patch to tell GTK that lpr accepts PDF output
The LPR backend for GTK asserts that "lpr" cannot accept PDF files. Granted, you can't tell in general whether lpr in a given situation will be able to print a PDF or not, but declaring that it can't is needlessly restrictive. The attached patch (works for both GTK2 and GTK3) adds the "accepts-pdf" property to the lpr backend and fixes the problem.
This patch is suggested as an alternative to the patch from the freebsd-gecko email thread "firefox-60.0_2,1 missing 'Print to LPR'", from May 13, 2018, which circumvents the problem by generating PostScript output instead of PDF. Fixing the problem in GTK means that other users of GTK won't have to create parallel workarounds.
Walter, firefox doesn't use gtk20 (except for Adobe Flash plugin) but the patch applies against both gtk20 and gtk30.
Is it legal to cite two port names in the title of the bug? The problem (and the patch) apply to both gtk2 and gtk3.
No problem (was my error with the title).
I had written a patch, that I had forgotten, that looks similar to yours. It has a few differences. I am not the best with GTK code, so I have no idea which is correct between your patch or mine in relation to the backend and is-virtual settings. I also include accepts-ps in the function call as the lpr filter I am using handles both.
Created attachment 196976 [details]
Alternate patch to fix GTK
I know less about GTK probably than anyone else on the project, so someone else should probably choose between these two patches. But the other backends don't specify "accepts-ps", so I assumed it was the default. Also, I wrote "GTK_PRINT_BACKEND (backend)" simply because that looked similar to what I saw in the other backends.
But it does seem to me like a very good idea to incorporate one of these patches.
Have you tried to submit the patch/rationale upstream? gnome@ (downstream) is understaffed and, probably, doesn't have enough expertise to review.
Offhand, I wouldn't know how to do that ...
I created an account on Gnome's GitLab server and created an issue for this: https://gitlab.gnome.org/GNOME/gtk/issues/1385
I created a pull request in the Gnome repo. It was marked for GTK4.