[python-win32] Dispatch InternetExplorer.Application fails

Rickey, Kyle W Kyle.Rickey at bakerhughes.com
Thu May 29 15:26:36 CEST 2008


Thanks, I got your example working but unfortunately the results didn't
work good. Here's links to 2 pictures for comparison, sensitive
information removed.

http://www.dsrt.org-a.googlepages.com/bad_report.png
http://www.dsrt.org-a.googlepages.com/good_report.png

It wouldn't let me attach the images because the message was over 30 KB.

Let me give a little more background on the process. Our software
generates reports as xml files that use xsl transformation. The xsl
files are in a separate directory from the xml reports. The pink boxes
in the bad picture are supposed to be bmp files from another directory.
The xml references 1 xsl which in turn does includes on multiple xsl
files.

Lastly, the 'Page n of nn' is the page numbering system. Once the page
loads in IE or FF a javascript function gets called to number the pages.

Are my efforts futile? Or am I missing something simple?


-Kyle Rickey

-----Original Message-----
From: python-win32-bounces at python.org
[mailto:python-win32-bounces at python.org] On Behalf Of Waldemar Osuch
Sent: Wednesday, May 28, 2008 3:26 PM
To: python-win32 at python.org
Subject: Re: [python-win32] Dispatch InternetExplorer.Application fails

>
> 2) use some python libraries (libxml2, libxslt) to transform the xml
to
> html. That part works but now how to I make a pdf from the html file?
>
I would use lxml for the transformation and wx for printing.
The example below will prompt you with the dialog but
it should be possible to silence it somehow.
Instead of Acrobat Printer I would use PDFCreator.
It is free and one of the myriad options is to automatically save
without prompting for a file name.

For example:

8<----------------------------------------------------------------------
--------
import wx
from wx import html
import lxml.etree as ET


def get_reports():
    xmlfile = 'report.xml'
    xslfile = 'style.xsl'
    for i in range(3):
        transform = ET.XSLT(ET.parse(xslfile))
        result = transform(ET.parse(xmlfile))
        yield ET.tostring(result)


class MyFrame(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, None)
        self.prn = html.HtmlEasyPrinting()
        but = wx.Button(self, label='Go')
        self.Bind(wx.EVT_BUTTON, self.PrintReports)

    def PrintReports(self, evt):
        for rpt in get_reports():
            self.prn.PrintText(rpt)


if __name__ == '__main__':
    app = wx.PySimpleApp()
    frame = MyFrame()
    frame.Show(True)
    app.MainLoop()
_______________________________________________
python-win32 mailing list
python-win32 at python.org
http://mail.python.org/mailman/listinfo/python-win32


More information about the python-win32 mailing list