?
Solved

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

Posted on 2009-02-12
2
Medium Priority
?
517 Views
Last Modified: 2012-06-27
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.

http://www.experts-exchange.com/Networking/Windows_Networking/NT/Q_20668029.html
0
Comment
Question by:JayAZ
2 Comments
 
LVL 29

Accepted Solution

by:
Bill Bach earned 250 total points
ID: 23627820
Use the suggestion from the other post, but send the proper printer codes FIRST.

To do this, you can try a free tool like HPSET (www.goldstarsoftware.com/tools.asp) with the command:
    HPSET LAND
This sends the needed codes for a Landscape, 16.67 CPI fixed-width font, typically used for 132-column wide reports.

The text string that this sends is the following:
    "\033&l1o7.27C\033(10U\033(s0p16.67h8.5v0s0b0T"
Where \033 is the Esc character (Decimal 27).

If you want a specific font, and to set all of the other things like margins to an exact value, then you'd need to expand the printer codes to include those pieces of information, too.
0
 

Author Comment

by:JayAZ
ID: 23667571
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

0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You may have already been in the need to update a whole folder stucture using a script. Robocopy does it well and even provides a list of non-updated files in a log (if asked to). Generally those files that were locked by a user or a process by the …
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question