/    Sign up×
Community /Pin to ProfileBookmark

Word.Application print to non-default printer

Is there a way to have the printout function print to a different printer than the default. All of the computers in our company have a PDF printer. When working in a Microsoft document, when they print, the user can choose to print to the PDF printer which will convert the file into a PDF file.
I’ve written a JavaScript function attached to a button that prints an html file directly without user input by using the Word.Application object, but right now, it can only print to the default printer that is set on that computer. One option when users print from Word is a PDF printer. I’d like to add a 2nd button that will allow the user to save the HTML file as a PDF using the PDF “printer” which is included on all of our computers. Is it possible to change the printer to use from within the JavaScript Word.Application PrintOut function? If so, how can I change it without setting it as the default printer?

Chris

to post a comment
JavaScript

9 Comments(s)

Copy linkTweet thisAlerts:
@ccote1authorApr 03.2017 — Oh, and another item I forgot to mention is that our computers only have IE, so I don't need to worry about printing from other browsers.
Copy linkTweet thisAlerts:
@rootApr 03.2017 — you select your printer in the printer dialog, all printers that you are authorised to print to will be listed when ypu try to print something, if they are not, you need to speak to your network admin to allow shared printing services on others printers.
Copy linkTweet thisAlerts:
@ccote1authorApr 03.2017 — Actually, I just found a solution to my issue. Here's the code I used to "Print" the file to the PDF writer printer:
[CODE]
currPrntr = objWord.ActivePrinter; //Save the current printer so we can change printer back to user's default

ActiveDocument = objWord.Documents(1);
objWord.ActivePrinter = "Foxit PhantomPDF Printer"; //Set the active printer to the "Foxit PhantomPDF Printer" printer.
objWord.PrintOut();[/CODE]


Using the ActivePrinter attribute allows you to change to another printer on the user's system. In my case, all of our computers are preconfigured with Foxit installed, so this works. Of course, if you are creating a public HTML file, you wouldn't be able to do this. You would have to use the default PrintOut function and have the user select the printer.
Copy linkTweet thisAlerts:
@rootApr 03.2017 — Please don't double post, your original post here could have been updated.

I have responded in that thread here : http://www.webdeveloper.com/forum/showthread.php?362859-Print-specific-div-of-HTML-file
Copy linkTweet thisAlerts:
@MilerPipJul 07.2021 — From the printer properties, change to the Paper tab and select Auto Selection from Paper Source option. Besides, in the MS Word's Menu bar, click Tools > Option. Then choose the Printer tab. On the default paper tray option, choose Use Default Printer Setting.
Copy linkTweet thisAlerts:
@BlacksAbsJul 07.2021 — I am enough of these people who revive these old threads.

Did you see that this thread is from 2017?
Copy linkTweet thisAlerts:
@MilerPipJul 07.2021 — I am sorry!

I am new to this forum and I didn't notice this.

Sorry!
Copy linkTweet thisAlerts:
@BlacksAbsJul 07.2021 — Another time be more attentive.
Copy linkTweet thisAlerts:
@NogDogJul 07.2021 — {"locked":true}
×

Success!

Help @ccote1 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...