[python-win32] win32print not printing

Marcelo Almeida marcelo.cra at hotmail.com
Fri Jan 25 16:36:36 CET 2013


>
>
> On 24/01/2013 18:44, Marcelo Almeida wrote:
> > Hello everyone,
> >
> > I am trying to print a string (not a file) with win32print api and I'm
> > using Tim Golden's
> > <http://timgolden.me.uk/python/win32_how_do_i/print.html> third block of
> > code (pasted below) as a testing example but without success. There is
> > just no errors and the printer spool show the file rapidly and then
> > nothing occurs.
> I just printed using that code in both Python 2 & Python 3, so there's
> nothing obvious, I'm afraid. Is it possible that your default printer
> isn't what you think it is?
> TJG


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 one part of the
documentation<http://timgolden.me.uk/pywin32-docs/win32print__StartDocPrinter_meth.html>
that
I found on your website (the last phrase, last line):

"Note that the printer driver might ignore the requested data type."

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?

Thanks,
Marcelo.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20130125/bb9259cc/attachment.html>


More information about the python-win32 mailing list