Hi all,

 

When I run my code to print an image file, the standard “Print” dialog appears as expected, and my file is printed without problems if I click “OK”. However, if I click “Cancel” on the dialog, Win32::Printer opens a dialog box with a cryptic error (about a printer object not being created) that my users will not understand and that I don’t want them to see. Any ideas on how I can suppress (or take control of) this behavior from Win32::Printer? I expect that I need to use an eval block, but I’m not sure how to use eval (getting all sorts of syntax errors). Here’s my code:

 

 

my $dc = new Win32::Printer

(

    papersize => LETTER,

    dialog => NOSELECTION,

    description => ' Coloring Page(s)',

    unit => 'mm'

);

 

# If I click “Cancel”, nothing hereafter will be executed…

 

$dc->Image("file.bmp", 10, 10, 187, 258);

$dc->Close();

 

 

Thanks in advance,

Rob