
How to print a document from a script
Check C. Washingtons site. There are a few solutions demonstrating
to print a directory listing. if you like to print a document file itself,
things are getting a bit strange.
- A text file may be printed using Notepad (Use run to shell out something
like oWShell.Run "Notepad.exe /p" & your_path_and_file, 1, true
- A HTML file can be printed using MSHTML.DLL, like something:
oWSHShell.Run "Rundll32.exe MSHTML.dll,PrintHTML " & _
WScript.ScriptFullName, 7, true
- or you can use the oIE.ExecWB 6, -1 method from IE.
- printing a DOC, XLS file may be done using Word or Excel either
- printing PDFs may be done using Adobe Acrobat ActiveX control.
See newsletter #5 in my WSH Bazaar, that deals extensively how to
print PDFs. Samples for automation from Office with WSH are also in
the WSH Bazaar.
Actually is no easy way to print any registered document file in WSH.
But I wrote an ActiveX that provides a method to print any registered
document type (even bmp, gif, tiff, pdf and so on). If you are interested,
I can send you the ocx for test purposes.
G. Born
Check out the WSH Bazaar at:
www.borncity.de
Dennis O'Neill schrieb in Nachricht ...
Quote:
>I want to write a script to read a directory and print all its contents to
>the current printer, anyone know how to tell a document to print? In
>particular I will be printing pdf documents.
>Thanks
>dennis