472,960 Members | 1,925 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,960 software developers and data experts.

Perl in Windows How Do I Print/Write to the Printer

Hi,
I can write and print to the terminal, but do not know how to write or
print to the printer. The examples I saw, did not work. Please either
tell me or direct me to some documentation.
Thanks, in advance,
Gary
gj******@cox.net
Jul 19 '05 #1
3 7311
Gary Efron <ge*****@cox.net> wrote in message news:<VbO%b.3085$506.900@fed1read05>...
I can write and print to the terminal, but do not know how to write or
print to the printer. The examples I saw, did not work. Please either
tell me or direct me to some documentation.

Open a filehandle and write to that handle. If your printer is on the
network, do something like:

use IO::Socket;
my $remote_host = '192.168.1.49';
my $remote_port = '9100';
my $socket = IO::Socket::INET->new(
PeerAddr => $remote_host,
PeerPort => $remote_port,
Proto => 'tcp',
Type => SOCK_STREAM,
) || die "Couldn't connect to $remote_host\:$remote_port : $@\n";
while ( my $psdata = <DATA> ) { print $socket $psdata; }
Jul 19 '05 #2
Roel van der Steen wrote:
Gary Efron <ge*****@cox.net> wrote in message news:<VbO%b.3085$506.900@fed1read05>...
I can write and print to the terminal, but do not know how to write or
print to the printer. The examples I saw, did not work. Please either
tell me or direct me to some documentation.

Open a filehandle and write to that handle. If your printer is on the
network, do something like:

use IO::Socket;
my $remote_host = '192.168.1.49';
my $remote_port = '9100';
my $socket = IO::Socket::INET->new(
PeerAddr => $remote_host,
PeerPort => $remote_port,
Proto => 'tcp',
Type => SOCK_STREAM,
) || die "Couldn't connect to $remote_host\:$remote_port : $@\n";
while ( my $psdata = <DATA> ) { print $socket $psdata; }


Thanks for your help, but I was trying to write to a local printer.
Gary Efron
gj******@cox.net
Jul 19 '05 #3
Gary Efron <ge*****@cox.net> wrote in message news:<PMN1c.27985$aZ3.27893@fed1read04>...
Thanks for your help, but I was trying to write to a local printer.


Maybe you just want to try Win32::Printer?
Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Arthur | last post by:
Hi Everyone, I'm having a real hard time with this. Maybe some smarter people can assist. I'm running Mandrake 9.2. I have a Laserjet 4M Plus. I want to be able to print Postscript, bold,...
0
by: bezel | last post by:
I have a program written in C++ we are converting to C#. It is a Windows Service, running on an application server farm which takes an asynchronus RPC request from a user (through a bunch of...
54
by: Sathyaish | last post by:
I am trying to print to the printer. I am using a VC++ 6.0 compiler on Win 2K, but I get an error saying that stdprn is not defined. Why is that? Is it because of Windows, I am guessing? Do I have...
3
by: Larry Maturo | last post by:
I'm not sure if this is the right group to post this to, but here goes. I need to find out the name of the print spool file for every job queued to a particular printer. I actually need to read a...
1
by: pcleong | last post by:
Hi, I am new to Perl script Currently trying to print data to a network printer, but there is nothing printed out after the script is ran. Is there any configuration I need to set? My printing...
6
by: atinti | last post by:
I'm tyring to write something that will send a simple email using Perl so far this is what I have #!/usr/bin/perl -w use strict; my $executable = "saplotus.exe'; my $server =...
9
by: =?Utf-8?B?Sm9obiBBdXN0aW4=?= | last post by:
I have an app that prints entry tickets. If the printer driver is not set up exactly to detect the black mark on the back of the ticket, the tickets do not print correctly. Because of this, all...
3
by: printline | last post by:
Hello Guys I cannot print from a locally installed printer that is mapped to a windows 2003 sever. I have installed the printer locally and can print locally. I connect to the windows 2003...
10
by: happyse27 | last post by:
Hi All, I got this apache errors(see section A1 and A2 below) when I used a html(see section b below) to activate acctman.pl(see section c below). Section D below is part of the configuration...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.