Print to PDF printer without PS conversion

Asked by Schlomo Schapiro

CUPS works with PDFs internally and my printer (Officejet Pro X476dw) also understands PDF.

Why does CUPS still convert each print job to Postscript, even if it was submitted as a PDF?

For example doing "lpr PDF-file.pdf" leads to this filter chain:

I [24/Oct/2014:07:56:17 +0200] [Job 263] Started filter /usr/lib/cups/filter/pdftopdf (PID 27176)
I [24/Oct/2014:07:56:17 +0200] [Job 263] Started filter /usr/lib/cups/filter/pdftops (PID 27177)
I [24/Oct/2014:07:56:17 +0200] [Job 263] Started filter /usr/lib/cups/filter/hpps (PID 27178)
I [24/Oct/2014:07:56:17 +0200] [Job 263] Started backend /usr/lib/cups/backend/hp (PID 27179)

See https://gist.github.com/schlomo/5b2fe300552319b7f61c for full log

I would like to understand why this PS step is still required and if it is possible to skip it while still keeping the ability to affect print options.

This issue is not about printing a single PDF file in raw mode but to change the way how all jobs are printed from all applications.

Also I would like to know if there are any known limitations that arise from sending print jobs as PDF instead of as PS to the printer.

Question information

Language:
English Edit question
Status:
Open
For:
HPLIP Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Johannes Meixner (jsmeix) said :
#1

I did not analyze the issue in detail, therefore only a hint FYI:

The CUPS filtering is mainly determined by the PPD file
because the PPD file specifies what final data format
must be sent to the printer device.

In your https://launchpadlibrarian.net/188105323/hp-check.txt
from your https://bugs.launchpad.net/bugs/1385055
I found:
----------------------------------------------------------
PPD Description: HP Officejet Pro X476-X576 MFP Postscript (recommended)
----------------------------------------------------------

It seems that PPD tells CUPS it is a PostScript printer
and accordingly CUPS produces PostScript.

Revision history for this message
Schlomo Schapiro (sschapiro) said :
#2

Hello Johannes,

yes, I saw that. Is there a way to rewrite the PPD to be a PDF printer? Is
there some PPD you could recommend for copying from?

Kind Regards,
Schlomo

On Friday, 24 October 2014, Johannes Meixner <
<email address hidden>> wrote:

> Your question #256131 on HPLIP changed:
> https://answers.launchpad.net/hplip/+question/256131
>
> Johannes Meixner posted a new comment:
> I did not analyze the issue in detail, therefore only a hint FYI:
>
> The CUPS filtering is mainly determined by the PPD file
> because the PPD file specifies what final data format
> must be sent to the printer device.
>
> In your https://launchpadlibrarian.net/188105323/hp-check.txt
> from your https://bugs.launchpad.net/bugs/1385055
> I found:
> ----------------------------------------------------------
> PPD Description: HP Officejet Pro X476-X576 MFP Postscript (recommended)
> ----------------------------------------------------------
>
> It seems that PPD tells CUPS it is a PostScript printer
> and accordingly CUPS produces PostScript.
>
> --
> You received this question notification because you asked the question.
>

Revision history for this message
Johannes Meixner (jsmeix) said :
#3

I think only the HPLIP authors can provide a PPD that results
the exact right PDF for this particulat printer device.

Unfortunately it seems neither on
http://www.openprinting.org/drivers
nor on
http://www.openprinting.org/printers/manufacturer/Generic
it seems there is not (yet?) a generic PPD for PDF printers.

Right now I did not find a really comprehensive documentation
how to make a PPD for a PDF printer - I only found some notes in
http://www.linuxfoundation.org/collaborate/workgroups/openprinting/pdf_as_standard_print_job_format
(I recommend to read the full text)
in particular therein I found
--------------------------------------------------------------------
The new foomatic-db-engine has extensions for the PDF workflow
in its PPD generator. Especially PPDs are generated with the lines
*cupsFilter: "application/vnd.cups-postscript 100 foomatic-rip"
*cupsFilter: "application/vnd.cups-pdf 0 foomatic-rip"
--------------------------------------------------------------------
and in
http://www.cups.org/documentation.php/doc-1.7/spec-ppd.html?VERSION=1.7&Q=#cupsFilter
in particular
--------------------------------------------------------------------
*% Pass-through filter for PostScript printers
*cupsFilter: "application/vnd.cups-postscript 0 -"
--------------------------------------------------------------------

Putting both together I think having
--------------------------------------------------------------------
*% Pass-through filter for PDF printers
*cupsFilter: "application/vnd.cups-pdf 0 -"
--------------------------------------------------------------------
in a generic PostScript PPD should convert it
into a generic PDF PPD.

What I mean is:
Get a generic PostScript printer PPD e.g. from
http://www.openprinting.org/printer/Generic/Generic-PostScript_Printer
and have line as the on and only "*cupsFilter" line
--------------------------------------------------------------------
*cupsFilter: "application/vnd.cups-pdf 0 -"
--------------------------------------------------------------------
in the PPD.

E.g. the PPD from
http://www.openprinting.org/printer/Generic/Generic-PostScript_Printer
you may change it so that it looks as follows
--------------------------------------------------------------------
*PCFileName: "PDF.PPD"
*Manufacturer: "Generic"
*Product: "(PDF Printer)"
*cupsVersion: 1.0
*cupsManualCopies: True
*cupsModelNumber: 2
*cupsFilter: "application/vnd.cups-pdf 0 -"
*ModelName: "Generic PDF Printer"
*ShortNickName: "Generic PDF Printer"
*NickName: "Generic PDF Printer"
--------------------------------------------------------------------

To verify whether the idea should basically work
I did the following (on my SLES12 test system
with CUPS 1.7.5 and cups-filters 1.0.58):

I made a PDF.ppd as show above.

In /etc/cups/cups-files.conf I set
FileDevice Yes

In /etc/cups/cupsd.conf I set
LogLevel debug

I re-started the cupsd.

I set up a test print queue using
# lpadmin -p testy -v file:/tmp/testy.prn -m PDF.ppd -E

I submitted a test print job:
# echo hello | lp -d testy

I inspected the CUPS filtering:
# grep PID /var/log/cups/error_log
that results:
----------------------------------------------------------------
Started filter /usr/lib/cups/filter/texttopdf (PID 3464)
Started filter /usr/lib/cups/filter/pdftopdf (PID 3465)
PID 3464 (/usr/lib/cups/filter/texttopdf) exited with no errors.
PID 3465 (/usr/lib/cups/filter/pdftopdf) exited with no errors.
----------------------------------------------------------------

Accordingly /tmp/testy.prn is a PDF file:
# file /tmp/testy.prn
----------------------------------------------------------------
/tmp/testy.prn: PDF document, version 1.3
----------------------------------------------------------------

Ghostscript (using "gs -r75 /tmp/testy.prn")
shows it correctly but that may not mean much
whether or not a PDF printer can print it correctly.

I do not have a PDF printer so that I cannot verify
whether or not that PDF in testy.prn is sufficiently
generic so that a PDF printer can actually print
it correctly.

But the basic idea how CUPS can produce PDF
should work this way.

Revision history for this message
Johannes Meixner (jsmeix) said :
#4

I submitted an enhancement reques to OpenPrinting.org
to provide a "Generic PDF Printer" PPD:

https://bugs.linuxfoundation.org/show_bug.cgi?id=1234

Revision history for this message
Schlomo Schapiro (sschapiro) said :
#5

So should I open a bug for that? How can I contact the HPLIP developers who
could do this?

Another question would be if the printer options (duplex, paper tray, print
quality ...) will be still passed on to the printer after modifying the PPD
to produce PDF.

Revision history for this message
Johannes Meixner (jsmeix) said :
#6

If my generic PDF.ppd works at all for your printer device,
it cannot provide any support for device specific settings.

I would file an enhancement "bug" at HPLIP
because I think for HP devices that support PDF directly,
HPLIP should support direct PDF printing workflow.

I am not an expert here but I think the less conversion steps
in the workflow the better the possible printout quality,
in particular for high-end devices that are advertised by HP
to produce high quality printouts.

Revision history for this message
Johannes Meixner (jsmeix) said :
#7

When you submit an issue via the links at
http://hplipopensource.com/hplip-web/support.html
the HPLIP developers get directly involved.

Does the generic PDF.ppd work for your printer device?

Revision history for this message
Schlomo Schapiro (sschapiro) said :
#8

Could you please attach your PDF.ppd (or send me directly)? That way I will test what you tested.

Revision history for this message
Johannes Meixner (jsmeix) said :
#9

It seems one cannot attach files to questions so that
I simply attached my PDF.ppd.gz to your somehow related
https://bugs.launchpad.net/bugs/1385055

To set up a print queue with PDF.ppd.gz in an arbitrary directory use
# lpadmin ... -P /path/to/PDF.ppd.gz ...

Revision history for this message
Schlomo Schapiro (sschapiro) said :
#10

I checked the PPD and it works for printing:

$ grep -i 'job 272.*PID' /var/log/cups/error_log
I [24/Oct/2014:15:32:38 +0200] [Job 272] Started filter /usr/lib/cups/filter/pdftopdf (PID 32726)
I [24/Oct/2014:15:32:38 +0200] [Job 272] Started backend /usr/lib/cups/backend/hp (PID 32727)
D [24/Oct/2014:15:32:38 +0200] [Job 272] PID 32726 (/usr/lib/cups/filter/pdftopdf) exited with no errors.
D [24/Oct/2014:15:32:46 +0200] [Job 272] PID 32727 (/usr/lib/cups/backend/hp) exited with no errors.

As suspected setting paper trays and duplex options does not work at all.

Can you help with this problem?

Provide an answer of your own, or ask Schlomo Schapiro for more information if necessary.

To post a message you must log in.