GNOME Bugzilla – Bug 650461
evince fails to print PS file to PDF file (Launchpad #784228)
Last modified: 2018-05-22 14:14:43 UTC
Hi all, Just copying from #784228 in Launchpad: "" Askubuntu user sdaau reports the following [1]: "This is my problem: Open a document in Evince, choose Print Choose "Printer": "Print to file" Choose "Output Format": "PDF" (add a filename output.pdf in the box if not there) Click on "Print" Experience the following message: < Failed to print document. < Printing is not supported on this printer. By the way, printing to an "Output Format" .ps file works fine. " I can reproduce this bug trying to print a PS file to PDF. Sample file is attached, created with LibreOffice 3.3 on Natty. evince 2.32.0-0ubuntu12.1 libreoffice-calc 1:3.3.2-1ubuntu4 Ubuntu 11.04 fresh install with all ~/.* user settings copied from 10.10 installation. [1] http://askubuntu.com/questions/37066/evince-print-to-pdf-file-fails-to-print "" The example .ps file on Launchpad is: https://bugs.launchpad.net/ubuntu/+source/evince/+bug/784228/+attachment/2132813/+files/test_ps.ps
It appears that error message means the printer doesn't accept PS input, and skimming GTK code suggests the file backend supports PS only if you select PS output. Given that, I'm not really sure how this ever worked, but I guess one of GTK or Evince had its printing reworked or something. (Also, could you guys please change the text of that error? The current one reads a bit like a joke. "Printing isn't supported on my printer? What are you talking about? It's a printer!")
I just found this bug after hitting exactly the same problem. Quite apart from the fact that this is 2012 and I've been happily printing Postscript files on Linux since forever (i.e. it makes no sense that Postscript can't be printed, especially when I have a Postscript printer!), the error message makes no sense. Please at least fix that.
I can reproduce this bug with evince 3.4.0. It could be a bug in the gtkprint pdf backend.
I should mention that this bug is also present in 3.6.0. It's not obvious to me why it should be a bug in the PDF backend: I only ever see it when trying to print Postscript files.
(In reply to comment #4) > I should mention that this bug is also present in 3.6.0. > > It's not obvious to me why it should be a bug in the PDF backend: I only ever > see it when trying to print Postscript files. Because evince is using that API. It could be either a misuse of the API by evince or the backend itself.
(In reply to comment #1) > It appears that error message means the printer doesn't accept PS input, and > skimming GTK code suggests the file backend supports PS only if you select PS > output. Given that, I'm not really sure how this ever worked, but I guess one > of GTK or Evince had its printing reworked or something. > > (Also, could you guys please change the text of that error? The current one > reads a bit like a joke. "Printing isn't supported on my printer? What are you > talking about? It's a printer!") I tend to agree with this... However, I don't understand the printing code that well. I am adding Adrian to the cc list. QAdrian, why is ps not accepted by the file printer when printing a pdf? I am a bit confused, because the API doc for GtkPrinter says something about input format for the printer... since this is a file printer, I would guess that it would support any of the formats... Anyway, we don't really send a PS file to the printer, but actually draw directly using cairo, so maybe we are misusing the API and we shouldn't ask whether ps is supported on the printer. Anyway, I am grateful for any further info you could provide.
The evince PS backend does not use cairo. It uses libspectre (which uses ghostscript). Looking at the code it should be possible to print a PS file as PDF. The ps_document_file_exporter_begin function in http://git.gnome.org/browse/evince/tree/backend/ps/ev-spectre.c creates a spectre PDF exporter. The spectre PDF exporter (http://cgit.freedesktop.org/libspectre/tree/libspectre/spectre-exporter-pdf.c) looks like it is using ghostscript to do the conversion. The code for PS -> PDF conversion exists so if it is not working then it is a bug in either evince or libspectre.
I can confirm that bypassing the check for gtk_printer_accepts_ps in libview/ev-print-operation.c allows printing to PDF to work again. I won't submit a patch as this is 100% not the correct answer, but for a work-around, it works. Whichever procedure or library is responsible for setting the "accepts-ps" property of the GtkPrinter is to blame. I can't find the culprit, but I'm fairly sure it's not in libspectre. I was able to reproduce the problem with the same version of libspectre as I have on older systems where print-to-pdf works out of the box (version 0.2.6.1 through 0.2.7 don't affect the result one way or the other).
Still broken in 3.10.3
Created attachment 286526 [details] [review] Prevents any action from being taken if the gtk_printer_accepts_ps call returns false.
As no one else has done anything with this for a long time, and it's still broken, I've attached the patch that I've been using for over a year (with 80+ employees using it with no problem). I know it's for version 3.6.1, and it's a complete hack, but it works.
FYI, this has been a meme since 2011: http://weknowmemes.com/2011/11/failed-to-print-document-printing-is-not-supported-on-this-printer/
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/evince/issues/219.