none
print a text file with landscape orientation RRS feed

  • General discussion

  • I can print a text file easily using gc and lp, e.g.:

    PS C:\Users\nick> get-content .\test.txt|out-printer "epson wp-4525 series"

    But I really want this to come out in landscape. My Linux colleagues, annoyingly, point out how easy it is to do this with CUPS (-o landscape). Surely there is a simple powershell way to do this?

     

    Friday, May 15, 2015 9:43 AM

All replies

  • I don't think you can do it with the cmdlet, you can use word com object though to accomplish the same thing - 

    $word = new-object -com word.application
    $word.Documents.Open(<doc>)
    $word.ActiveDocument.PageSetup.Orientation = 1
    $word.activedocument.PrintOut()

    Friday, May 15, 2015 10:36 AM
  • You can set up a spooler queue that is set to landscape by default and print to that.  This is pretty standard in most shops where legacy text output is sent to printers.

    \_(ツ)_/

    Friday, May 15, 2015 11:55 AM
  • Thanks for this - works great on my PC. Unfortunately the server I am building this for does not have Word installed (sure enough I get "resource unavailable").

    I am trying cygwin enscript to create postscript files - so far so good!

    Tuesday, May 19, 2015 8:48 AM