IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New OK, I've done SOMETHING like this...
With IE. About 5 years ago. To translate highly IE-specific web pages to pdfs. The same approach might work for you.

I jury-rigged it. Badly.

What I did is had a machine specifically set up for this job. (Careful. Do not touch. Scaffolding may fall down...) By hand I installed the appropriate printer drivers and configured IE to print to a default file using the driver that I wanted. (If anybody chose to print anywhere else, everything would break. I believe that some idiot did this. Once. And was told very sternly never to do that again.) This part was done by hand and was the bit that couldn't be touched without breaking everything. This was because, like you, I couldn't figure out how to get IE to print with the driver I wanted to the file I wanted. But I could configure it to do what I wanted by hand.

I then wrote a Perl server that opened IE, made sure there was no file where it wanted to print, and listened on a port. Every time it received a request it used Win32::OLE to navigate IE to that page. It then used Win32::OLE to tell the page to print. Which meant that it went to that file. The program then collected that file, sent it back over the socket, cleaned up the file, then went listening for another request.

This server tried to start every few minutes. So if something killed it, it would come back up.

Unlike your situation I could make this a batch process. Once a day I figured out which pdfs needed to be re-created, and created them. Then shipped them to the webservers.

Believe it or not, this worked. About 8 months later the idiot developer who wrote the IE-specific HTML in the first place (see my comments elsewhere about "destructive productivity") was finally convinced to rewrite the HTML to be more generic so that we could just run his HTML through the html2pdf utility. (This allowed us to make his code interactive. He took some convincing and there was plenty of grumbling that I should just let the webservers talk live to my jury-rigged box...) I gleefully killed that machine and threw away the code to dissuade people from asking me to do something that stupid again.

Cheers,
Ben
I have come to believe that idealism without discipline is a quick road to disaster, while discipline without idealism is pointless. -- Aaron Ward (my brother)
New Need more info.
I've downloaded the word2xxx.pl OLE automation example, which does launch Word and control it a bit.
Where do I find a list of things I can do so I know how to call the proper functions?
New I'm the wrong person to ask about that
You can find some (all?) of it in Word's documentation if you've installed the Visual Basic reference guide.

I remember wandering through some guide on MSDN looking for likely functions. I think I found it by asking a VB programmer where to look. This was 5 years ago, I wouldn't have any hope of finding it again now.

Perhaps some VB people know the answer?

Cheers,
Ben
I have come to believe that idealism without discipline is a quick road to disaster, while discipline without idealism is pointless. -- Aaron Ward (my brother)
New OK, done this piece
They had a sample DLL that writes to a specific dir.
I can pickup the new file from there since I can serialize the workflow.
So I execute word with a macro argument to print to the driver and then exit.

     Pity you? Hah! Pity me! - (broomberg) - (18)
         Come up with a new job title that doesn't include that duty -NT - (Yendor) - (2)
             LOL! -NT - (Steve Lowe) - (1)
                 Shun! - (jb4)
         ACK! I gotta write a dll - (broomberg) - (6)
             That shouldn't be horribly bad - (jake123) - (1)
                 Photoshop piece is already taken care of - (broomberg)
             have you looked at openOffice 2.1 automation? - (boxley) - (3)
                 Nope - (broomberg) - (2)
                     oops, thought OpenOffice could translate $MS word -NT - (boxley) - (1)
                         Not well enough for me -NT - (broomberg)
         Oh too bad - (tuberculosis) - (1)
             Grrrr -NT - (broomberg)
         You got me - (JayMehaffey)
         Never - (ben_tilly)
         OK, I've done SOMETHING like this... - (ben_tilly) - (3)
             Need more info. - (broomberg) - (2)
                 I'm the wrong person to ask about that - (ben_tilly) - (1)
                     OK, done this piece - (broomberg)

Give a man a fish, and chances are you won't be asked to be in charge of buying a gift ‘from all of us’ anymore.
77 ms