Changing printers with PrintOut method

I currently have an intranet web page at work which contains a large-width table along with a “Print” button. When the user hits the Print button, I have a script that opens up an instance of Word, adds a footer that says (“For Official Use Only”) then prints the document on 11x17 paper in landscape format.
Now, I’d like to add another button that will save it as a PDF by using Word to print to the PDF “printer” that creates a PDF file. Is it possible to change the printer from the default printer to go to another printer? I have been trying to use the Word.Application’s PrintOut method, but can’t get it to work properly. On the Microsoft page, it shows that there are a number of attributes that you can use in a VBA script, but I’m not sure how to translate it into a JavaScript function.
For example, in VBA I would use: ActiveDocument.PrintOut(OutputFileName: abc.pdf, PrintToFile: true, copies: 1). When I try to use this methodology in JS, though, I get an error. I then tried to use the function with all of the attributes, using null for those I don’t need. In this case, I get an error that says “The number must be between -32765 and 32767”, but I don’t know which number the error refers to.
Can someone please help?


This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.