Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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!


In reply to Re: Formatting win32 printer output by Courage
in thread Formatting win32 printer output by jrta

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-19 18:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found