rsilvergun has asked for the wisdom of the Perl Monks concerning the following question:
It works nicely trouble is IE's print engine sucks, and messes up the format of my report. I can foobar the HTML to make the report print nicely in IE, but I'm much rather just use Gecko/Firefox. Anyone know some way to get Firefox to print my HTML from perl (or offer up the print dialog for printing the HTML)? If all else really fails I can use javascript in my HTML to for a print and then call Firefox on it via System, but that's a pretty ugly hack, since it splashes a Firefox window on the screen ;/.#!/usr/bin/perl use strict; use warnings 'all'; use Win32::OLE; use Win32::OLE::Const 'Microsoft Internet Controls'; use Win32::OLE::Variant; # From Vc7/PlatformSDK/Include/MsHtmHst.h : use constant PRINT_DONTBOTHERUSER => 0x01; use constant PRINT_WAITFORCOMPLETION => 0x02; my $file = "C:\\FixReportBase\\realtest\\pg_0001.htm"; my $do_not_prompt = 0; my $nCmdID = OLECMDID_PRINT; my $nCmdExecOpt = OLECMDEXECOPT_PROMPTUSER; my $pvaIn = PRINT_WAITFORCOMPLETION; my $pvaOut = 0; if ($do_not_prompt) { $nCmdExecOpt = OLECMDEXECOPT_DONTPROMPTUSER; $pvaIn |= PRINT_DONTBOTHERUSER; } my $IE = Win32::OLE->new('InternetExplorer.Application') or die; #$IE->{'Visible'} = 1; $IE->Navigate( $file ); sleep 1 while $IE->{Busy}; $IE->ExecWB($nCmdID, $nCmdExecOpt, Variant(VT_I2,$pvaIn), $pvaOut); $IE->Quit();
|
---|
Replies are listed 'Best First'. | |
---|---|
Don't know if it'll be of use to anyone
by rsilvergun (Acolyte) on Jun 20, 2007 at 03:23 UTC | |
Re: Firefox equivalent to Win32:OLE?
by ForgotPasswordAgain (Vicar) on Jun 20, 2007 at 10:33 UTC | |
Re: Firefox equivalent to Win32:OLE?
by rsilvergun (Acolyte) on Jun 21, 2007 at 04:27 UTC | |
by rsilvergun (Acolyte) on Jun 22, 2007 at 00:43 UTC |