1

When I run lpr <filename>.jpg the file prints out boderless (this is what I want).

When I run subprocess.call("/usr/bin/lpr " + tmp.name, shell=True) from a Python program, it prints out with borders.

I also tried to call it with "lpr -o StpBorderless=True -o StpiShrinkOutput=Expand .jpg" with the same borders still being printed.

Output from lpoptions shows the below (StpBorderless=True, and StpiShrinkOutput=Expand should make it borderless I think).

How can I execute lpr from a Python script to use the exact same options as if I executed it from command line?

auth-info-required=none
copies=1
device-uri=usb://Canon/CP800?serial=DH00071100000840
finishings=3
job-hold-until=no-hold
job-priority=50
job-sheets=none,none
marker-change-time=0
number-up=1
printer-commands=none
printer-info='Canon CP800'
printer-is-accepting-jobs=true
printer-is-shared=false
printer-location printer-make-and-model='Canon SELPHY-CP770 - CUPS+Gutenprint v5.2.9'
printer-state=3
printer-state-change-time=1433298534
printer-state-reasons=none printer-type=2134028
printer-uri-supported=ipp://localhost:631/printers/Canon_CP800
StpBorderless=True
StpiShrinkOutput=Expand 
Brian McCarthy
  • 757
  • 1
  • 6
  • 11
  • are you sure that you are using the same lpr in both cases? What is the output of 'which lpr' in the command line? – rleelr Jun 03 '15 at 14:50
  • I made sure it was the same one, which lpr shows it at /usr/bin/lpr – Brian McCarthy Jun 03 '15 at 15:27
  • When I test the print command from the command line it is actually, "lpr .jpg", but from python it is actually a tmp file (from a tempFile.NamedTemporaryFile(delete=False) call. There is no extension so it is simply, "lpr tmpnzt4mE". Could that have any affect. I can't check until I get home. – Brian McCarthy Jun 03 '15 at 17:39

0 Answers0