0

The .spl files in Windows system folder at C:\Windows\System32\spool\PRINTERS can be converted to different formats with 3rd party utilities and apps but my question is about powershell.

Is there some ways, simple powershell commands can be used to convert spool data into pdf ot rtf?

Peter Duniho
  • 68,759
  • 7
  • 102
  • 136
Shoki
  • 21
  • 12
  • I really can't think of a use case for this. Yet, I sure you have one. Anyway... PowerShell can do a lot, but not everything. So, Nope, not natively. Meaning, there is nothing native in PowerShell for this use case. You are going to have to write your own C/C++/C# thing, using a bunch of the MS undocumented printer stuff …(http://www.undocprint.org/formats/winspool/spl) ...or you need to use those 3rdP stuff. The latter is the easier path. – postanote Mar 02 '19 at 09:33
  • @postanote you can also write your own parser in Powershell, you aren't limited to C/C++/C# (you can do everything possible in C# from Powershell, worst case scenario is writing MSIL opcodes from Powershell). – bluuf Mar 02 '19 at 11:13
  • bluuf, I've been using PowerShell since before it was called PowerShell aka Monad. So, Yeppers, I fully understand what can be done with it. PowerShell is really a gateway drug to C#, the more elaborate/elegant you end up striving for. Add-Type, as we all know allows other classes, libraries to be used in PowerShell, but that's not native PowerShell, but PowerShell using all of what .Net allows, thus language integration / Interop. I use C# regularly in my scripts, as needed and PowerShell from my C# apps as needed. – postanote Mar 02 '19 at 20:10
  • Berka, the Out-Printer cmdlet (https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/out-printer?view=powershell-5.1) allows you to send script output to any printer you choose. Yet, your post says convert. So, the built in Windows PDF/XPS printer could be your target if print to pdf/xps if that is all you are after. – postanote Mar 02 '19 at 20:16
  • I've personally not tried this, nor do I know anyone who has. Yet, the cmdlet only sends the output to the target printer. If you specicaly wan to see what it is doing, remember PowerShell Core is Open source. So, you can look at all the underlying code. See ... https://github.com/jhoneill/6Print …. https://github.com/PowerShell/PowerShell/blob/master/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/out-printer/PrinterLineOutput.cs – postanote Mar 28 '19 at 21:51

0 Answers0