Solved

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

Posted on 2004-10-21
156 Views
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.

0
Question by:Luckyperl
    5 Comments
     
    LVL 48

    Expert Comment

    by:Tintin
    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.
    0
     
    LVL 20

    Expert Comment

    by:jmcg
    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.
    0
     

    Author Comment

    by:Luckyperl
    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"

    Thanks
    0
     
    LVL 20

    Accepted Solution

    by:
    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.
    0
     
    LVL 48

    Assisted Solution

    by:Tintin
    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.
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Suggested Solutions

    Title # Comments Views Activity
    Syslog text file into database or into .CSV 19 63
    perl script 4 80
    Migrate OTRS to newest version. 1 282
    batch script for automated email 12 84
    A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
    There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
    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…
    This video Micro Tutorial is the first in a two-part series that shows how to create and use custom scanning profiles in Nuance's PaperPort 14.5 (http://www.experts-exchange.com/articles/17490/). But the ability to create custom scanning profiles al…

    856 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

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now