Bug 795934

Summary: Printing PDFs fails on Brother HL-5340D
Product: [openSUSE] openSUSE 12.2 Reporter: Joseph Comfort <Joseph.Comfort>
Component: PrintingAssignee: Johannes Meixner <jsmeix>
Status: RESOLVED DUPLICATE QA Contact: E-mail List <qa-bugs>
Severity: Major    
Priority: P5 - None    
Version: Final   
Target Milestone: ---   
Hardware: All   
OS: openSUSE 12.2   
Whiteboard:
Found By: Community User Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Joseph Comfort 2012-12-26 20:57:16 UTC
User-Agent:       Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Firefox/17.0

The Brother HL-5340D does not have a driver entry through the standard CUPS setup, but it comes with a PPD file.  The file was copied to /usr/share/cups... where it was found and printing was set up.  The test page was fine.  I did not have any (known) problems on SuSE 12.1.

In printing something from the web, I did not get the document but instead a page that said
   ERROR NAME;
       stackunderflow
   COMMAND;
       pop
   OPERAND STACK
Other documents produce different messages.

I saved the document to a .pdf file.  lpr-ing it to the printer gave the same message.  Converting to .ps via pdf2ps then produced a blank page.  Converting to .ps via pdftops produced a correct printout.

A pdf document produced from pdflatex prints just fine.  But pdf2ps applied to it yields a blank page.  Also, okular also seems to print pdf documents fine.  So the problem appears to be with ghostscript conversions that can be invoked by the printer (CUPS?) driver.

The problem is new in 12.2.  I saw nothing like this in 12.1.  I believe it is different from the 'setoverprintmode' problem in other reports.  I do not get this message (and the poppler-based pdftops is OK).

Reproducible: Always

Steps to Reproduce:
1. produce a short .pdf file.  (It may or may not print fine with lpr)
2. apply pdf2ps
3. lpr the .ps file
Actual Results:  
If the .pdf file is produced by something based on ghostscript (perhaps from a web script), error messages will happen when lpr-ed to a printer.
The file generated via pdf2ps gives a blank page.

These claims are true for the HL-5340D printer.  I do not know about other printers.

Expected Results:  
All files should print correctly via lpr.

The ppd file can be provided if needed.  (Also available on the Brother web site.)
Comment 1 Joseph Comfort 2013-01-02 00:47:05 UTC
The problem is much worse than I thought.  First, some good news: using a CUPS+gutenprint driver for the Brother HL5140D, I could lpr .pdf and .ps files to the printer.  So I shifted over to this driver.

The bad news: I can not print a document from the web (I use firefox), either a news story, an order confirmation, a receipt, an email,...  The issue is true for either driver.  The documents get into the printer queue, but there is no printer response.  (I keep deleting them from the queue so that the next job at least has a chance of printing.)

I have to raise the Importance to Major.  The workaround of writing to a pdf file and converting (with the right program) to postscript is not good.
Comment 2 Johannes Meixner 2013-01-03 14:31:45 UTC
The bug's subject
"Printing through ghostscript fails on Brother HL-5340D"
and its initial description in comment#0
"Brother HL-5340D does not have a driver"
seem to contradict each other because when no driver is used,
usually Ghostscript is not called but the PostScript is sent directly
to the printer, see "Printer drivers: Make the printer print" at
http://en.opensuse.org/Concepts_printing

In your case your printer fails to process the PostScript
and prints a PostScript error message.


It seems the switch from PostScript to PDF as the standard
print job format has become the topmost reason for various
new printing issues.

This switch is advocated by the
OpenPrinting workgroup of the Linux Foundation
and the CUPS author, see "PDF as standard print job format"
http://www.linuxfoundation.org/collaborate/workgroups/openprinting

See also
"PDF: The future common printing format" at
http://en.opensuse.org/Concepts_printing

For my personal opinion see
https://bugzilla.novell.com/show_bug.cgi?id=732442#c5

At least in the foreseeable future there will be more PDF
printing issues in particular with "special PDF features".

For example transparency in PDF (in PostScript there is no transparency),
see in particular
http://en.wikipedia.org/wiki/Transparency_%28graphic%29#Transparency_in_PDF
---------------------------------------------------------------------------
PDF transparency is a very complex model, its original specification by
Adobe being over 100 pages long.
...
The fact that the PDF transparency model is so complicated means that
it is not well supported. This means that RIPs and printers often have
problems printing PDFs with transparency.
---------------------------------------------------------------------------

Basic PDF printing works and worked all the time because
PDF is and was always a supported print job format.

But the zillions of possible settings and features is what
never did and still does not work as well with PDF as it
does with PostScript - compare "Background Information" at
http://en.opensuse.org/SDB:How_to_Report_a_Printing_Issue


When you print a PDF from a PDF viewer application it depends what
the PDF viewer application sends to CUPS.

For example when you print a PDF from the Adobe Reader,
the Adobe Reader itself converts the PDF to PostScript
so that the Adobe Reader sends PostScript to CUPS.
Often the Adobe Reader works best to print PDF to that at least
as a workaround one should use the Adobe Reader to print PDF
(regardless that the Adobe Reader is non-free software).

When you print a PDF directly (i.e. not via the Adobe Reader),
CUPS runs first of all /usr/lib/cups/filter/pdftops which is
a wrapper that calls /usr/bin/pdftops that actually converts PDF
to PostScript and /usr/bin/pdftops belongs to the poppler-tools RPM.

In contrast /usr/bin/pdf2ps that also converts PDF to PostScript
is a bash script that calls Ghostscript to actually do the conversion.
Perhaps your printer only supports PostScript level 1 or 2 so that you
may have to call pdf2ps with "-dLanguageLevel=1" or "-dLanguageLevel=2"
see the "Usage" info when you call pdf2ps without arguments.


Regarding your comment#1
"using a CUPS+gutenprint driver for the Brother HL5140D,
 I could lpr .pdf and .ps files"

In this case Ghostscript is called together with the gutenprint driver
to make the printer-specific data but the gutenprint driver makes PCL
and not PostScript and that PCL works on your printer,
see "Printer drivers: Make the printer print" at
http://en.opensuse.org/Concepts_printing


Regarding your comment#1
"I can not print a document from the web (I use firefox)"

I think this particular issue is a duplicate of bnc#795582
for which a poppler update is meanwhile available.

Joseph Comfort
please install the poppler update and provide feedback
if printing via the gutenprint driver works again
also from Firefox on your Brother HL5140D.

For the poppler update "rpm -q --changelog poppler-tools | head"
must show those entries:
-------------------------------------------------------------------------
* Sat Dec 22 2012 stefan.bruens@rwth-aachen.de
- avoid division by zero when using origpagesizes option
  (bnc#795582)

* Sat Sep 29 2012 zaitor@opensuse.org
- Add poppler-fix-postscript-error-setprintermode.patch, fix
  printing with postscript capable printers that fail in some cases
  (bnc#774627).
-------------------------------------------------------------------------
Comment 3 Joseph Comfort 2013-01-04 04:00:38 UTC
The update to poppler-tools came after my testing and bug report, so the messages and fixes crossed.  I got and installed the update, and it appears that the various problems I reported are now fixed.  The divers for HL5140 appear to work for the HL5340.  Even the HL5340 PPD file from Brother appears to work also.

Thank you.  openSUSE 12.2 is good to go for me.

One clarification on my original post, which might not have been clear.  While there is no HL5340 driver option in the SuSE packages for setup in CUPS, a Brother BR5340_2_GPL.tar.gz file, which is a PPD, comes with the printer.  This file was copied to /usr/share/cups/model/manufacturer-PPDS/brother, where the CUPS setup routine finds it and can use it.  With the fix to poppler-tools, it seems reasonable to include this driver file in the distribution.
Comment 4 Johannes Meixner 2013-01-04 08:51:17 UTC
Regarding "include this driver file in the distribution":

Often PPD files from manufacturers are not under a free license,
see "Conditions" at
http://en.opensuse.org/SDB:Information_for_Printer_Manufacturers_Regarding_Linux_Support

If PPD files from Brother are under a free license:
One could get in contact with the OpenPrinting workgroup
of the Linux Foundation at
http://www.linuxfoundation.org/collaborate/workgroups/openprinting
so that the free PPD files from Brother get included
at the OpenPrinting web site.
This way all Linux users could get the PPDs from there
and then also all Linux distributions can provide them.
In particular regarding openSUSE
see "openSUSE printer driver software packages" at
http://en.opensuse.org/Concepts_printing
and bnc#641704
Alternatively one could get in contact with Brother so that
Brother provides all their free PPDs to OpenPrinting.
But according to
http://www.openprinting.org/driver/Postscript-Brother
there are already free PPD files from Brother at OpenPrinting.
The "Supplier: Brother" indicates that Brother already
provides free PPDs to OpenPrinting but currently at least
the one for the HL5340 is missing there.
Perhaps the HL5340 is a relatively new model and Brother
forgot to submit its PPD file to OpenPrinting?
Please get in contact with Brother and ask them why their
PPD file for the HL5340 is not available at OpenPrinting.

If PPD files from Brother are not under a free license:
You should get in contact with Brother and ask for free PPD files
because only free PPD files can be included in the Linux
distributions and only with PPD files that are included
in the Linux distributions Brother's PostScript printers
could "just work out of the box".
It never did work satisfying when only a few people who work at
Linux distributiors ask printer manufacturers for free PPD files
and free printer driver software.
It should work when many customers ask their printer manufacturers
for free PPD files and free Linux printer driver software.
Leverage hint:
Notably HP and to some extent also Epson are printer manufacturers
who provide free PPD files and free printer driver software, see
http://en.opensuse.org/SDB:Printer_buying_guide
and customers are free to choose a printer manufacturer
who really supports free software ;-)

*** This bug has been marked as a duplicate of bug 795582 ***