Have you seen www.htmltopdf.org? Otherwise might I suggest http://www.openreport.org/; you could then transform your XML into RML(xml reporting format) into a PDF. You can also design RML with OpenOffice.
~Gerdus On Tue, May 27, 2008 at 10:41 PM, Rickey, Kyle W < [EMAIL PROTECTED]> wrote: > Tim, thanks for your response. I realize where I've got this messed up. > > I had turned off Windows File Protection for > C:\Program Files\Internet Explorer > So that I could replace internet explorer with my own executable that > calls firefox :) The reason for this is some of our proprietary software > is hardcoded to launch files in IE, but there are advantages to using > firefox instead. > > Anyway, that's a bit off topic. I restored the real IE and rebooted and > now > >> ie = win32com.client.Dispatch("InternetExplorer.Application") > works as expected. > > I'm also checking out PAMIE but I'm beginning to think I may be going > about this whole thing the wrong way. > > Basically, said software above generates reports as xml files. The xml > file references an xsl file used to transform the report. This xml gets > launched and transformed by IE. > > What we want to happen is a way to take that xml file and go to PDF. As > it is now we have to print from IE to the Adobe Acrobat PDF printer. > This is cumbersome for the amount of reports that need run. So here are > some solutions I was considering: > > 1) COM into IE and load the xml, print it to PDF. Works, but we still > get prompted for the file name to save the pdf as (my code could supply > an appropriate name) > > 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? > > 3) COM into Adobe Acrobat and generate the pdf (no idea where to begin) > > 4) Rewrite entire reporting system to use pdf natively. Since the data > is freely available in our SQL server, this would be possible, but very > time consuming. > > I'm open to suggestions on a better way to go about this. Also, assuming > I changed the registry to point to iexplore2 (original IE) would COM'ing > into work? > > Kyle Rickey > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Tim Golden > Sent: Tuesday, May 27, 2008 2:46 PM > Cc: python-win32@python.org > Subject: Re: [python-win32] Dispatch InternetExplorer.Application fails > > Rickey, Kyle W wrote: > > Whenever I try the following: > > > >>> import win32com.client > >>> ie = win32com.client.Dispatch("InternetExplorer.Application") > > > > I get this traceback: > > > > Traceback (most recent call last): > > File "<interactive input>", line 1, in <module> > > File "C:\Python25\Lib\site-packages\win32com\client\__init__.py", > line > > 95, in Dispatch > > dispatch, userName = > > dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx) > > File "C:\Python25\lib\site-packages\win32com\client\dynamic.py", > line > > 98, in _GetGoodDispatchAndUserName > > return (_GetGoodDispatch(IDispatch, clsctx), userName) > > File "C:\Python25\lib\site-packages\win32com\client\dynamic.py", > line > > 78, in _GetGoodDispatch > > IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, > > pythoncom.IID_IDispatch) > > com_error: (-2147024894, 'The system cannot find the file specified.', > > None, None) > > > > Any ideas what would cause this? My end goal is to COM into IE and > load > > an xml file, then print it to PDF. > > FWIW, you might find it worth looking at PAMIE which uses COM > the way you're doing, but which has already ironed out a few > creases. That said, it doesn't really answer your question. Can > you see what result this script gives: > > <code> > import os > import _winreg > > hKey = _winreg.OpenKey ( > _winreg.HKEY_CLASSES_ROOT, > r"InternetExplorer.Application\CLSID" > ) > clsid, type = _winreg.QueryValueEx (hKey, "") > > print clsid > > hKey = _winreg.OpenKey ( > _winreg.HKEY_CLASSES_ROOT, > r"CLSID\%s\LocalServer32" % clsid > ) > server, type = _winreg.QueryValueEx (hKey, "") > > print server, os.path.exists (server.strip ('"')) > > <code> > > This should, crudely, go through the same steps that > the Dispatch process does and should show up whether > IE's not where it thinks it should be. The strip () > on the server name is because, on my machine, the > location is double-quoted, presumably because it's > got an embedded space which would cause some problem > in the mechanism. > > TJG > _______________________________________________ > python-win32 mailing list > python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > _______________________________________________ > python-win32 mailing list > python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 >
_______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32