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