I am able to print from Inkscape to my CUPS-configured network printer just fine. I would like to do the same directly from the shell command line as given by the https://unix.stackexchange.com/a/12002/21372 answer. But when I try that on my Ubuntu system, after I convert the SVG files to either PDF or Postscript using Inkscape, sending it to lpr gives the error shown below on the front panel of the printer (a Xerox 6180MFP):

photo of my front panel error

Commands I'm trying to use are:

inkscape --without-gui --export-pdf=test_file.pdf test_file.svg
pdftops test_file.pdf test_file.ps
lpr -P Xerox-6180MFP-D -l test_file.ps

What do I need to do to my CUPS configuration to enable it? What is Inkscape doing behind the scenes to successfully print to the printer, that I am unable to do from the lpr command line?

For reference, here is a gist of my current CUPS configuration file: https://gist.github.com/bgoodr/6f8b47df40244fed6290a6a199e72c52

Output of lpstat -t:

scheduler is running
no system default destination
device for Xerox-6180MFP-D: socket://
device for Xerox-6180MFP-D/double-sided: socket://
device for Xerox-6180MFP-D/single-sided: socket://
Xerox-6180MFP-D accepting requests since Sat 04 Mar 2017 05:36:44 PM PST
Xerox-6180MFP-D/double-sided accepting requests since Sat 04 Mar 2017 05:36:44 PM PST
Xerox-6180MFP-D/single-sided accepting requests since Sat 04 Mar 2017 05:36:44 PM PST
printer Xerox-6180MFP-D is idle.  enabled since Sat 04 Mar 2017 05:36:44 PM PST
printer Xerox-6180MFP-D/double-sided is idle.  enabled since Sat 04 Mar 2017 05:36:44 PM PST
printer Xerox-6180MFP-D/single-sided is idle.  enabled since Sat 04 Mar 2017 05:36:44 PM PST

Screenshot of my printer page at http://localhost:631/printers/Xerox-6180MFP-D

screenshot of CUPS page


In response to a comment at How to print PDF or Postscript files to printer directly from the command line :

Here is the script I used to run lpr both with and without the -l option (shown below without it):

cd /tmp
qrencode -v 1 -t svg -o some_small_text.qrcode.svg -l L "some small text"
inkscape --without-gui --export-pdf=some_small_text.qrcode.pdf some_small_text.qrcode.svg
# setsid evince some_small_text.qrcode.pdf >/dev/null 2>&1 &
pdftops some_small_text.qrcode.pdf some_small_text.qrcode.ps
lpr -P Xerox-6180MFP-D some_small_text.qrcode.ps

Here is a gist of the Postscript file generated from the above call to qrencode:


The "Load Tray" error leads me to believe I have to specify some more things to the lpr command, or modify some of the options. Somehow Inkscape is able to communicate its needs from the print dialog it requires me to interact with, and it is that I desire to replicate from the lpr command line.


I ran lpr without options and got:

$ echo stuff | lpr
lpr: Error - no default destination available.


I have partially solved the riddle of where the "Load Tray 1(MPT) ... 76x127mm" error on the front panel of the printer is coming from. When I opened up the Inkscape GUI, and examined the properties on the .svg file generated by the qrencode command shown above, I see:

Document properties on original .svg file

Notice the width and height. When I tried to print that using the GUI, I got the same "Load Tray 1(MPT) ... 76x127mm" error! So, I then selected "US Letter" from the Page Size section, and then attempted to print it to the printer, and it worked without a hitch.

So, apparently what is happening is that the printer is seeing this small (in width and height) postscript file and assuming it needs to select a 3 x 5 inch envelope tray. I reason that from looking at page 69 from http://download.support.xerox.com/pub/docs/6180MFP/userdocs/any-os/en/user_guide_en.pdf which has:

User Guide From 6180MFP User Guide Page 69

So I am a bit closer to the answer to my original question. I just now need a way to be able to choose the Paper Source or change the size from the command line. I've looked at the inkscape man page, and it is not obvious which options are the ones I should play with. Or perhaps this is an imagemagick/convert type of operation.

  • If Inkscape does make the file as you commanded, sudo may not be required for those commands. But try sudo in front of the lpr command. The CUPS configuration file seems to set up several options for 'owner/administrator'. Worth a try - hope it works.
    – Craig
    Mar 5, 2017 at 2:31
  • A problem might arise with the -l parameter, trying to send raw data. The *.ps file is already formatted. The output might be confusing the system. What happens when you send the command without the -l argument? Also, can you tell the results of not specifying a printer? If either of those work, we can focus on what's happening with the printer specification. Mar 5, 2017 at 3:12
  • @L.D.James I edited my post for additional info: I tried both with and with the -l option and got no error messages from lpr. It is only from the printer that the error shows up. I probably need to study up on the "options" that I need to configure in CUPS to clarify some formatting or "tray" or something; I'm must not sure yet.
    – bgoodr
    Mar 5, 2017 at 19:44
  • Added a second edit to supply results of running lpr without arguments.
    – bgoodr
    Mar 5, 2017 at 22:38
  • Added a third edit showing that I'm getting closer to an answer which now boils down to getting this small SVG file sized to an 8.5 X 11 inch size akin to what I did in the Document Properties.
    – bgoodr
    Mar 6, 2017 at 5:03

1 Answer 1


This is what I had to do:

cd /tmp
qrencode -v 1 -t svg -o some_small_text.qrcode.svg -l L "some small text"
sed 's%<svg width="[^"]*" height="[^"]*" viewBox="[^"]*"%<svg width="8.5in" height="11in" viewBox="0 0 203.94463 263.92834"%g' < some_small_text.qrcode.svg > some_small_text.qrcode.us-letter.svg
inkscape --without-gui --export-pdf=some_small_text.qrcode.us-letter.pdf some_small_text.qrcode.us-letter.svg
lpr -P Xerox-6180MFP-D some_small_text.qrcode.us-letter.pdf

The key is that I had to change the width, height, and viewBox attributes of the svg element to match up with what Inkscape does when you select US Letter. The values used for the viewBox remain a mystery to me. Once I did that, then the resulting PDF, when sent to the printer, kept the printer happy.

This is not exactly what I wanted, since in this approach, I have to use sed to modify the attributes. I would have rather found a way to use Inkscape to do this on the svg directly. I do see that Inkscape has a -verb option and a verb called DialogDocumentProperties in http://how-to.wikia.com/wiki/How_to_use_Inkscape_in_commandline_mode/List_of_verbs but it is not apparent how to actually select the "US Letter" size using that option.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .