[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now


perl code to get a list of printer name from user's pc

Posted on 2004-10-21
Medium Priority
Last Modified: 2008-03-06
Hi all, I posted this question a few months ago and no one could answer it. I would like to ask again  if anyone know the way to do it now. thanks

I have a Perl applicaiton running on the unix platform. Users can access the application via  ie browser from their laptop or PC (window xp).  The question is: when user clicks a print button in the perl application, is that a way to what printers are installed/available  on user's PC from perl application?  I am a newbie to Perl and unix stuffs, So any help is appreciated. Thanks in advance.

Question by:Luckyperl
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 48

Expert Comment

ID: 12374283
If the user does

File->Print from their browser they can select a printer.

It's not possible to do it via a server side Perl (or any other language) application.
LVL 20

Expert Comment

ID: 12390710
So what you might be able to do is let the user pick a printer from a list of printers that the server knows how to print to and store that selection (via a cookie or a persistent session variable).

What you cannot do, without violating the web browser security model, is include some script code in a web page that retrieves arbitrary information from the user's PC. I think the default printer selection probably falls under this general prohibition. If you and your users were willing to violate the security model, then it'd be fairly simple to have them download and execute a program that would report the printer selection back to your web server.

Author Comment

ID: 12396967
Could you give more specific or example about this?

"include some script code in a web page that retrieves arbitrary information from the user's PC"

LVL 20

Accepted Solution

jmcg earned 1000 total points
ID: 12397296
Suppose you could write some scripting code on a web page that, without asking the user, searched the hard drive for Quicken data files and extracted account information from them, then sent this information back to a place of the web site's choosing. That's the sort of scenario that the browser's security model is intended to prevent. Of course, learning what printer the user has selected as a default does not sound like such a terrible security problem, but it's something that currently lies outside the boundary of things the browser allows scripts to know.
LVL 48

Assisted Solution

Tintin earned 1000 total points
ID: 12397704
My approach would be similar to jmcg's first suggestion.

The first time a user goes to print, they are given a list of printers to send it to.  When they have selected their desired printer, a cookie is set so that they don't need to select the printer again.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

650 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