Peter, I wanted to let you know I really appreciated your post on this
issue. I have been looking for a good work-around to the printing problem,
and your first solution below is awesome, the only thing I had to add was
quotes around $file. Here's a sample script I wrote to test it out:
 
#!perl -w
 
use strict;
 
my $filename="$0.$$.html";
 
open(FH,">$filename");
print FH "<HTML><BODY><H1>testing</H1>This is a test</BODY></HTML>";
close(FH);
 
my $dll = "$ENV{'WINDIR'}/System32/mshtml.dll";        
system("rundll32.exe $dll,PrintHTML \"$filename\"");
 
unlink $filename; #delete temp file;

 

-----Original Message-----
From: Peter Eisengrein [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 25, 2003 6:02 AM
To: 'Cruickshanks, Darin'; Perl-Win32-Gui-Users
Subject: RE: [perl-win32-gui-users] Perl and printing


There may be a better way, but here are two possible ways:
 
### THIS WILL BRING UP THE SAME PRINT WINDOW AS USED BY WEB BROWSER
 
  $dll = "$ENV{'WINDIR'}/System32/mshtml.dll";        
  system("rundll32.exe $dll,PrintHTML $file");
 
 
-OR-
 
 
### THIS MAY OR MAY NOT GIVE THE BEST RESULTS
 
  system("copy $file \\\\ServerName\\PrinterName");
 
 
Good luck.
 

-----Original Message-----
From: Cruickshanks, Darin [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 24, 2003 11:12 AM
To: Perl-Win32-Gui-Users; [EMAIL PROTECTED]
Subject: [perl-win32-gui-users] Perl and printing


All,
 
 
I have a Perl application that uses Win32::GUI to provide a nice front end
for a database, what I would really like to do is provide a print feature
with the ability to print to a network printer through the gui.  Does anyone
know of any way to do this?
 
Cheers,

Darin

--------------------------------------------

Darin Cruickshanks
Labs Manager, Computing Service
University of Essex
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 
01206 873585

 

Reply via email to