Thursday, December 19, 2019

mac - printing via commandline (CUPS) with photo printer


I'm having a problem printing a photo via commandline, using CUPS.
Im using Mac(tried on Mountain Lion and Mavericks) and Canon Selphy CP900 photo printer.
I have the correct drivers.


From the command line, here is my printer info:


$ lpstat -d


system default destination: Canon_CP900


$ lpoptions


copies=1 device-uri=usb://Canon/CP900?serial=C412070200000609 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 CP900' printer-is-accepting-jobs=true printer-is-shared=false printer-location=ibomac printer-make-and-model='Canon CP900' printer-state=3 printer-state-change-time=1385005687 printer-state-reasons=none printer-type=2134028 printer-uri-supported=ipp://localhost:631/printers/Canon_CP900


$ lpoptions -l


PageSize/Page Size: *Postcard(4x6in) CP_L_size CP_C_size Custom.WIDTHxHEIGHT


If I view the photo.jpg via Preview app, it lets me print it without problem. here is the screenshot.


Preview Print Settings


Now if try it via commandline like this:


$ lp -o landscape -o fit-to-page -o media=Custom.4x6in photo.jpg


request id is Canon_CP900-18 (1 file(s))


It gets accepted and queued but I get the error:


enter image description here


My suspicion is because in the System Preferences | Printers Scanners, the settings doesnt have the 4x6 size in the list :


enter image description here


So what I did was, I opened Firefox browser, went to page setup, and added a custom size paper thru this dialog box:


enter image description here


I named it "Postcard".


So once I have that addition, going back to Printer Scanners settings, it now lists "Postcard" as one of the custom sizes.


I've tried the commandline print command again but I got the same error. I wasnt expecting Mac to be this hard when it comes to printing (or is it my sucky printer driver?). Pls help.


I want this commanline to work because I want to automate it with my custom program.
I use this CUPS documentation as reference.


Somebody help pls? :)


Answer



I also faced the same issue. Following your steps I manage to print with this command


lp -o media="Postcard(4x6in)" image.png

the media size is one of the listed size in the command


 lpoptions -l

PageSize/Page Size: *Postcard(4x6in) CP_L_size CP_C_size Custom.WIDTHxHEIGHT


note : you have to drop the ''


No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...