Print from shell to HP wireless printer

I've been having trouble printing to my HP wireless (P1102W) printer from either of my 2 Macs. As a developer I spend a lot of time in the shell (bash) and have been quite happy with the command-line tools available. One of things I would like to do is print from the shell - either interactively or from a shell script.


The only ways I know how to do this involve using 'lp' or 'lpr' and I'm sure they work the way they are supposed to. Except apparently if you try to print to an HP printer like mine. It DOES print fine from any other applications.


When I send a print job to the printer from my Macbook Air shell or the iMac shell, a window pops up on my iMac telling me to load paper in the manual feed tray and press 'Enter'. When I press 'Enter' it prints the job. I'm trying to avoid this if possible.


Example:


grep '006.' music.trxt | lp


Email to HP Support came back with this:

"We are sorry to let you know that HP Printers are designed to print from Graphical User Interface applications. For example, the applications from which you can select File-> Print to open a print window for further options. So you are able to print from the other applications. Regarding printing from the shell, we do not have the required expertise since this directly deals with the MAC operating system. Hence, I would request you to contact the Apple support team for more information."


Hence my posting here.


Does anyone have any similar problems?


Have you found a work-around?


Is there a way to insert a form-feed or carriage-return on the command line as part of the print command? I've tried using the Ctrl-V - insert_a_command trick but no joy.


I love my iMac but this is driving me crazy. Thanks for any suggestions / help.

iMac, Mac OS X (10.7.5), HP P1102W wireless

Posted on Mar 17, 2014 2:11 PM

Reply
19 replies

Mar 18, 2014 9:40 AM in response to mouthbreather0

OK, added a new printer 'LPTerm' and tried to stay with defaults. Here's what lpoptions reports:


MouthBreather(user) : lpoptions -d LPTerm -l

APOptionalDuplexer/Duplex Printing Unit: True *False

Duplex/Duplex: *None DuplexNoTumble DuplexTumble

PageSize/Media Size: *Letter Legal A4 ISOB5 JISB5 LetterSmall LegalSmall A4Small

ManualFeed/Manual Feed: True False

InputSlot/Media Source: *Upper


So fewer options available but the InputSlot is now set to Upper.

The ManualFeed seems to be unset so I set it to false and it apparently took:


MouthBreather(user) : lpoptions -d LPTerm -l

APOptionalDuplexer/Duplex Printing Unit: *True False

Duplex/Duplex: *None DuplexNoTumble DuplexTumble

PageSize/Media Size: *Letter Legal A4 ISOB5 JISB5 LetterSmall LegalSmall A4Small

ManualFeed/Manual Feed: True *False

InputSlot/Media Source: *Upper


That didn't work so I set ManualFeed to True.


MouthBreather(user) : lpoptions -d LPTerm -l

APOptionalDuplexer/Duplex Printing Unit: *True False

Duplex/Duplex: *None DuplexNoTumble DuplexTumble

PageSize/Media Size: *Letter Legal A4 ISOB5 JISB5 LetterSmall LegalSmall A4Small

ManualFeed/Manual Feed: *True False

InputSlot/Media Source: Upper


Didn't work either. The printer queue shows the printer is busy trying to print a file but no joy. No pop-up window either.


Stuck again it seems.

Mar 18, 2014 7:59 PM in response to Frank Caggiano

Well, I just tried that after reading your last post. Same old. I think the crux is that 'Manual' setting for Media Source. And since that is the only option available I can't add / change it. C'est la vie.


Thanks again for trying.


The only other thing I can think of is to figure out how to insert the Carriage Return on the command-line as part of the string. I tried a few methods I know of but none worked.


--

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Print from shell to HP wireless printer

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.