Printing PDF files (win32)

Riaan Booysen riaan at e.co.za
Thu Aug 17 18:11:09 EDT 2000


Robin Becker wrote:
> 
> In article <399AE84E.63AE1144 at mail.com>, Jan Dries <jdries at mail.com>
> writes
> >
> >
> >Robin Becker wrote:
> >>
> >> >Does anyone know how to automate the printing of PDF files through
> >> >Acrobat Reader?
> >> >
> >> under unix it's fairly easy. I looked into doing this at one point, but
> >> I couldn't figure out the com interface. There is an ActiveX Acrobat
> >> Control, but I think that would be tough to use.
> >
> >The ActiveX Acrobat control has a very simple interface:
> >
> >1 property
> >       LPCTSTR GetSrc()
> >       SetSrc(LPCTSTR)
> >3 operations
> >       void Print();
> >       BOOL LoadFile(LPCTSTR fileName);
> >       void AboutBox();
> >
> >Loading the file with LoadFile() and subsequently printing it with
> >Print() works for me (in a C++ project). But the control is supposed to
> >be a visual control. I can't tell if it can work as a background
> >non-visual control.
> >
> >Regards,
> >Jan Dries
> >
> yes that was exactly my problem; how to get the document processing
> without a window.
> --
> Robin Becker

Here's yet another way to do it

import win32con
import win32api

win32api.ShellExecute(0, "print", <PDF_FILENAME>, None, "",
win32con.SW_HIDE)

where <PDF_FILENAME> is your file of choice.

This is fundamentally the same as right clicking on a document in
a folder and selecting 'Print'.

-- 
Riaan                     >>> a='a=%s;a%%`a`';a%`a`
___________________________________________________
Boa Constructor - RAD GUI building IDE for wxPython
     http://boa-constructor.sourceforge.net



More information about the Python-list mailing list