in reply to Printing from a browser

I would go with one of the first two solutions. But a third alternative is to use the Win32::OLE module to launch IE, load the page, and then print it. (It has been years since I've used the module, I don't know whether it will work with Firefox.)

Replies are listed 'Best First'.
Re^2: Printing from a browser
by PerliKnight (Acolyte) on May 21, 2007 at 15:04 UTC
    Thanks chaps (and chapesses).

    Printed those three out and will give them a go...

    Cheers,David

      Hi,

      Got

      $IE = Win32::OLE->new("InternetExplorer.Application") || die "Could not start Internet Explorer.Application\n";

      $IE->{visible} = 1;

      $URL = "http://news.bbc.co.uk";

      $IE->Navigate($URL);

      all of which works just fine. But... what's the one to send the page directly to the printer...? Anyone know?

      Thanks, David.

        in your OP (original post) you wrote:
        I want to be able to fetch a web page, save it in a file, render it in a browser and then print the rendered version.

        I can do the first 3 bits (LWP::Simple etc) but can't think how to get the rendered page to go straight to the printer.

        but your code example only passes a URL to the browser, not the file you've got with LWP::Simple. So no modification is applied. The browser gets the page directly from the source, no printing code in it. Maybe you want to modify the retrieved webpage, store it to a file and point the browser to that file.

        Another possibility is to set up a local proxy (see HTTP::Proxy) that retrieves the page on behalf of your browser, modifies it on the fly and serves it to your browser. You'd have to tell your browser to use that proxy.

        --shmem

        _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                      /\_¯/(q    /
        ----------------------------  \__(m.====·.(_("always off the crowd"))."·
        ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}