<div dir="ltr"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span style="font-family:arial,sans-serif;font-size:13px"><br>
On 24/01/2013 18:44, Marcelo Almeida wrote:<br></span><span style="font-family:arial,sans-serif;font-size:13px">> Hello everyone,<br></span><span style="font-family:arial,sans-serif;font-size:13px">><br></span><span style="font-family:arial,sans-serif;font-size:13px">> I am trying to print a string (not a file) with win32print api and I'm<br>
</span><span style="font-family:arial,sans-serif;font-size:13px">> using Tim Golden's<br></span><span style="font-family:arial,sans-serif;font-size:13px">> <</span><a href="http://timgolden.me.uk/python/win32_how_do_i/print.html" target="_blank" style="font-family:arial,sans-serif;font-size:13px">http://timgolden.me.uk/python/win32_how_do_i/print.html</a><span style="font-family:arial,sans-serif;font-size:13px">> third block of<br>
</span><span style="font-family:arial,sans-serif;font-size:13px">> code (pasted below) as a testing example but without success. There is<br></span><span style="font-family:arial,sans-serif;font-size:13px">> just no errors and the printer spool show the file rapidly and then<br>
</span><span style="font-family:arial,sans-serif;font-size:13px">> nothing occurs.</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">I just printed using that code in both Python 2 & Python 3, so there's<br>
</span><span style="font-family:arial,sans-serif;font-size:13px">nothing obvious, I'm afraid. Is it possible that your default printer<br></span><span style="font-family:arial,sans-serif;font-size:13px">isn't what you think it is?</span><br style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:arial,sans-serif;font-size:13px">TJG</span></blockquote><div><br></div><div style>No, it's not. I tested it (even using the EnumPrinter name of my printer - which prints with the ShellExecute command) and when I run the script my default printer spool show the document briefly, as if were printing. I'm a little bit confused about <a href="http://timgolden.me.uk/pywin32-docs/win32print__StartDocPrinter_meth.html">one part of the documentation</a> that I found on your website (the last phrase, last line):</div>
<div style><br></div>"Note that the printer driver might ignore the requested data type."<div><br></div><div>I'm guessing that the printer is ignoring the RAW type I'm using. I've tried EMF, EMFSPOOL, TXT but with them I get runtime errors. I also tried to print to a pdf printer (CutePDF Writer) and got a similar problem: the pdf document were created but no contents either. Is there much difference in the underlying code from this method to the ShellExecute method? Why would one work and the other not?</div>
<div><br></div><div style>Thanks,</div><div style>Marcelo.</div><div><div> </div></div></div>