If I am printing programmatically using cups.h, how do I find out what formats the printer will accept? For example, HP printers probably accept HPGL, but others may not. Some of the common possible printing formats are EPS, Postscript, PDF, HPGL, and PCL. How do I query the printer to find out which ones it will accept?

I would also be interested in knowing how to do it from the command line.

  • Is it possible that the different print formats are associated with different ports on the printer? If so, and if the printer is networked and you have permission, you could scan the available ports. – SauceCode Feb 22 '17 at 0:01
  • I'd assume (but didn't test) that printing via cups.h would also apply the Cups filters, which convert between formats, so you'd have to take them into account, too. Postscript is usually a safe bet. – dirkt Feb 22 '17 at 8:34
  • 1
    Not a query, but bugs.launchpad.net/ubuntu/+source/gs-esp/+bug/36532 might help fix the problem regardless? – Boxbot Feb 22 '17 at 20:55
  • 1
    You're not supposed to care about the printer's rendering capability. Just send postscript, CUPS will sort it out. – Jasen Aug 21 '17 at 10:56
  • 1
    You have to query the specification in the manual of the printer. – ceving Oct 16 '17 at 20:14

Looking at the lpinfo manpage (http://man7.org/linux/man-pages/man8/lpinfo.8.html):

#List drivers matching "HP LaserJet"
lpinfo --make-and-model "HP LaserJet" -m

I entered the command on a server and received output like the following:

foomatic:HP-DeskJet_1000C-pnm2ppa.ppd HP DeskJet 1000C Foomatic/pnm2ppa
foomatic:HP-DeskJet_1100C-pcl3.ppd HP DeskJet 1100C Foomatic/pcl3
foomatic:HP-DeskJet_1120C-pcl3.ppd HP DeskJet 1120C Foomatic/pcl3
foomatic:HP-DeskJet_1200C-pjxl300.ppd HP DeskJet 1200C Foomatic/pjxl300
foomatic:HP-DeskJet_1220C-pcl3.ppd HP DeskJet 1220C Foomatic/pcl3
foomatic:HP-DeskJet_1600CM-Postscript.ppd HP DeskJet 1600CM Foomatic/Postscript
foomatic:HP-DeskJet-deskjet.ppd HP DeskJet Foomatic/deskjet
foomatic:HP-DeskJet-pcl3.ppd HP DeskJet Foomatic/pcl3
foomatic:HP-DeskJet_Plus-deskjet.ppd HP DeskJet Plus Foomatic/deskjet
foomatic:HP-DeskJet_Plus-pcl3.ppd HP DeskJet Plus Foomatic/pcl3

You will notice pcl, postscript, etc. at the end of each line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.