You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
'As a user I want to be able to send output of a command to a printer.'
For example Get-Process | out-printer "OneNote"
would save the current processes to a new page in OneNote
or Get-Package | lp
Would send a list packages to the default printer
Hmm, looks like that's using System.Drawing. have you tested it on Unix? In my own experience, a vast majority of System.Drawing APIs are not functional on Unix OSes, frequently throwing exceptions.
Rain Sallow (/u/ta11ow) (@vexx32) I should have said this is only restoring functionality from Windows PowerShell to Windows.
This is fairly consistent, there is PrintManagement module which is Windows only. On Windows PS V6 and V7 can manage printers and print jobs but not submit a job to a printer.
On Linux one should be able to use | lp and use the built in command.
Previously the cmdlet was rejected as not ported. It is common rule that cmdlets in the repo should be ported. It would be great if you could implement ported version of the cmdlet.
Ilya (@iSazonov) If by "ported" you mean "in C# not PS" the repo has both the original PS version, and the C# version which is currently on the PowerShell gallery. It's probably a sign I should rearrange the repo :-)
Ilya (@iSazonov) Yes. Completely agree, cmdlets should work on all supported OSes, but this a should, not a must. We already have a Printer Management module which manages printer drivers, settings, queues and jobs (and it might make sense to out Out-Printer to this module). But this module only understands Windows print-devices, print-queues and print-jobs; Unix-based OSes have their own command line tools for managing these, Windows didn't have until PowerShell added them (and the "Print" command which has been around since DOS, is still in CMD but only sends a printer ready file to a port name like "PRN" or "LPT2" so is effectively "broken") .
My understanding of Linux isn't the best but AIUI you can docommand | lp and send Output to the printer.
Windows PowerShell 5 has Out-Printer with an alias of lp so you can do command | lp and send Output to the printer.
The only place where command | lpdoesn't work is on PowerShell core when running on Windows.
The idea is to plug that gap. Having something missing from some OSes is undesirable, but having something which was in Windows PowerShell 5 missing in 7 is probably worse - especially as any linux shell, including pwsh can print using | lp , which is their solution until the .NET portable subset gets printing support.
Michael Klement (@mklement0) Can you advice how better resolve this? Can we use the same way as you suggest for clipboard and call a native command (lp?) on Linux? MacOS(lp?)?
Activity
vexx32 commentedon Oct 1, 2019
Hmm, looks like that's using System.Drawing. have you tested it on Unix? In my own experience, a vast majority of System.Drawing APIs are not functional on Unix OSes, frequently throwing exceptions.
jhoneill commentedon Oct 1, 2019
Rain Sallow (/u/ta11ow) (@vexx32) I should have said this is only restoring functionality from Windows PowerShell to Windows.
This is fairly consistent, there is PrintManagement module which is Windows only. On Windows PS V6 and V7 can manage printers and print jobs but not submit a job to a printer.
On Linux one should be able to use | lp and use the built in command.
iSazonov commentedon Oct 1, 2019
Previously the cmdlet was rejected as not ported. It is common rule that cmdlets in the repo should be ported. It would be great if you could implement ported version of the cmdlet.
jhoneill commentedon Oct 1, 2019
Ilya (@iSazonov) If by "ported" you mean "in C# not PS" the repo has both the original PS version, and the C# version which is currently on the PowerShell gallery. It's probably a sign I should rearrange the repo :-)
iSazonov commentedon Oct 2, 2019
No, I mean that the cmdlet should work on all supported OSes. See #10340.
jhoneill commentedon Oct 2, 2019
Ilya (@iSazonov) Yes. Completely agree, cmdlets should work on all supported OSes, but this a should, not a must. We already have a Printer Management module which manages printer drivers, settings, queues and jobs (and it might make sense to out Out-Printer to this module). But this module only understands Windows print-devices, print-queues and print-jobs; Unix-based OSes have their own command line tools for managing these, Windows didn't have until PowerShell added them (and the "Print" command which has been around since DOS, is still in CMD but only sends a printer ready file to a port name like "PRN" or "LPT2" so is effectively "broken") .
command | lpand send Output to the printer.lpso you can docommand | lpand send Output to the printer.command | lpdoesn't work is on PowerShell core when running on Windows.The idea is to plug that gap. Having something missing from some OSes is undesirable, but having something which was in Windows PowerShell 5 missing in 7 is probably worse - especially as any linux shell, including pwsh can print using
| lp, which is their solution until the .NET portable subset gets printing support.iSazonov commentedon Oct 2, 2019
Michael Klement (@mklement0) Can you advice how better resolve this? Can we use the same way as you suggest for clipboard and call a native command (lp?) on Linux? MacOS(lp?)?