Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Formatting win32 printer output

by jrta (Novice)
on Jun 29, 2002 at 00:24 UTC ( #178178=perlquestion: print w/ replies, xml ) Need Help??
jrta has asked for the wisdom of the Perl Monks concerning the following question:

I'm going to be writing a UI for some text based reports and I wanted to give the users a print option. But the reports are all in an extremely wide format. I looked through the previous threads, and it wasn't too promising, but I was wondering if anyone knew how to send a print job with controls on the page layout. Thanks

Comment on Formatting win32 printer output
Re: Formatting win32 printer output
by erikharrison (Deacon) on Jun 29, 2002 at 01:01 UTC

    Well, a start would be to look at the Win32::* suite of modules. I've heard the occasional warning that they are poorly written, but they are the "canonical" interface to all aspects of the Win32 API.

    Cheers,
    Erik

    Light a man a fire, he's warm for a day. Catch a man on fire, and he's warm for the rest of his life. - Terry Pratchet

Re: Formatting win32 printer output
by Courage (Parson) on Jun 29, 2002 at 08:20 UTC
    Yes, it is possible via Win32::API module, but this will lead you to many problems. I did same things a few years ago from C++ and got certain result, but I'm not proud of it.

    I would suggest you an idea, which I tried yesterday and it is still in design stage, but anyway it works. Idea is following.

    Suppose you have MS Word installed on your machine. Prepare some template files that will reflect your page settings, some header, footer formattings.
    When you need to print a file, using Win32::OLE you're able to manage MSWord to print your contents as you designed to.

    Also, I succeeded now to use Internet Explorer browser window via Win32::OLE but did not fully succeeded, because it does not have "print" method - sad.
    Anyway, a code below should get you an idea what I'm trying to explain.

    use strict; use Win32::OLE; my $ie = Win32::OLE->new('InternetExplorer.Application'); # here we're manipulating at our will $ie->{Visible} = -1; $ie->{Left} = 0; $ie->{Top} = 0; for (0..150) { $ie->{Left}++; $ie->{Top}++; $ie->{StatusText} = '*'x$_; } $ie->Navigate('D:\Work\PerlScripts\doc\tools-describe.htm'); my $idoc = $ie->{Document}; $idoc->{title} = '=+='x10; # and even replace contents of a window at our will $idoc->open("text/html","replace"); $idoc->writeln(<<"EOS"); <html> <body><p>Hello, there!</body> </html> EOS #UNFORTUNATELY $idoc->print; is impossible, because 'print' method lac +ks here $ie->ExecWB(6,0);#This will try to print, but it's a cumbersome sleep(5); $ie->Quit;

    Courage, the Cowardly Dog.
    PS. My scratchpad now at "not-fully answered nodes" stage!

Re: Formatting win32 printer output
by Anonymous Monk on Jun 29, 2002 at 19:20 UTC
    http://www.perltk.org/contrib/index.htm Hope this help :) didier
Re: Formatting win32 printer output
by Courage (Parson) on Jun 30, 2002 at 21:44 UTC
    You know, a moment ago I accidentially found a file named Win32Print.tar.gz that has something about you're asking.

    Although there is no readme-s inside, I can't even figure out it's version. But still it tries to use Win32 API via C code to manipulate printer.

    It was not CPAN from where I downloaded it, and last thing I can add to this -- I downloaded it at 31 march 2002.

    Let me know if I should send this file to you somehow.

    Courage, the Cowardly Dog.

      Yeah, if you could send that to me that would be awesome. My e-mail at work is wf@wfib.com. Thanks a bunch.
Re: Formatting win32 printer output
by Anonymous Monk on Apr 04, 2004 at 23:39 UTC
    will you send me this file if you still have it? mrortner@conwaycorp.net thanks

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://178178]
Approved by rob_au
Front-paged by sparkyichi
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (10)
As of 2014-09-19 17:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (143 votes), past polls