These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Print to specific printer using PrintParams

showmehow
Registered: Jan 19 2009
Posts: 6

Hi,
I am trying to print a PDF to the default printer using the PrintParams object.

The adobe javascript reference tells me to use the syntax pp.printerName=""; for a default printer.
This is not working.
When I put that actaul name of the printer into the pp.printerName="printername"; this works fine and prints out everytime to the default printer.

What do I put in the printerName to make it go to the windows default printer?

Thanks
Showmehow

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Are you gettting any console messages?

What product and version of Acrobat/Reader are you getting this problem with?

What is the OS?

Does the instiallaiton conatin any combination of versions or products for Acrobat or Reader?

What is the entire script that is failing?

Have you read the notes about using the "print" method?

There have been a number of changes with newer versions of Acrobat.

Well, you can get the printer name from that property or just omitt that line of code.

George Kaiser

showmehow
Registered: Jan 19 2009
Posts: 6
Latest Adobe WinXP
Read through the print method

The issue at hand is this:
I have two PDFs that print from my website, the first should alaways print to the default printer, the second, users should have a choice as to which printer they wish to print to.
Now when opening Adobe Reader in a browser then closing it, the Reader stays memory resident for approx 1min before shutting down.
This is something Adobe developers have actively qritten into the program , I assume so as to increase performance when veiwing PDF on multiple web pages.
Due to this, when I use a print method to print the second PDF by selecting a printer, Reader appears to set this as it's default printer for the remainder of the time that it remains memory resident.
So if I go back to the first PDF and print it within the time that Reader is still memory resident, it treats the printer chosen by the second PDF as the default printer.
However if I wait until Reader removes itself from memory then print the first PDF, it prints from the 'real' os set default printer (the correct one).
It is atleast somewhat likely that due to the structure of my website people may be viewing the first PDF within a short timespan after printing the second, and if this occurs whilst Reader is still memory resident it will print to the wrong printer (not the default, the one chosen by second PDF print).
It is necessary to ensure that the first PDF always prints to the correct default printer.

The way I have so far gotten around this problem is to define the pp.printerName parameter each time prior to printing the first PDF.
However, so far I have been able to do this by hard coding the name of the default printer into a document level javascript that contains the print function.
Because many people may be using my website I need to be able to have the website determine which is the correct printer as default, all the time.

So far I have been able to get a list of printers from the pc using the app.printerNames method, however there is no explanation as to if it is possible to select which of these if the default win xp set printer.

So basically I need somehow through reader javascript to be able to determine what is the default printer on that system dynamically and assign this to the pp.printerName parameter each time prior to printing the first PDF.

Is there a solution to this?
Regards
Showmehow