Last week I figured out how to print to a physical printer from a PHP script on a Windows machine. This week...same question, with a Mac.
It's theoretically much simpler on a mac. The lpr command deals well with PDF files, so in theory this should work:
shell_exec('lpr ' . $filename);
But that fails (returns false). It doesn't work with a full path name, either.
Any clue? The script is able to write to the file, so those permissions are okay. Might it be a permissions problem in printing?
print to physical printer on a mac
Moderator: General Moderators
Re: print to physical printer on a mac
You may need to specify the name of the printer with -P
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.