Link to home
Start Free TrialLog in
Avatar of JayAZ
JayAZ

asked on

How to print Landscape, Courier New, 10pt in NT Batch

I'm looking for a way to print a text file via NT (win2k) batch script with the following format: Landscape, Courier New, 10pt, with 0.5 inch margins on left/right

I've seen a similar positing, but it was for an Image file.  I dont know how to modify it to fit my requirements.  Printers are HP9000 series, accepts PCL and Postscript.

https://www.experts-exchange.com/questions/20668029/Script-for-Scheduling-print-jobs.html
ASKER CERTIFIED SOLUTION
Avatar of Bill Bach
Bill Bach
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JayAZ
JayAZ

ASKER

I've tried to grasp printer codes, but to no avail.

I'd like to build off the example in the link from a previous submission/question.

In the following code (saved as PrintImg.vbs), it takes filename as the argument when called by cscript
ie:  cscript PrintImg.vbs <filename>

How can I modify it to set the font, font size, and margins?
courier 10pt, 1 inch margins all around

This little VB script uses OLE the create an instance of Word, creates a new document, imports the specified Image, sets the page orientation to landscape and sends the whole crap to the standard printer. After all it closes the document and destroys the ole object.
 
  wdOrientLandscape=1
  Set Args=WScript.Arguments
  FileName=Args(0)
  Set Word = WScript.CreateObject("Word.Application")
  Word.Visible = true
  Word.Documents.Add
  Set Doc = Word.ActiveDocument
  Doc.InlineShapes.AddPicture FileName, True, False
  Doc.PageSetup.Orientation = wdOrientLandscape
  Doc.PrintOut
  Word.ActiveDocument.Close False
  Word.Quit

Open in new window