[python-win32] How to print a PDF file?

Cox Chen coxchen at nature.ee.ncku.edu.tw
Fri Aug 8 15:45:38 EDT 2003


I'd like to print a PDF file without manipulating Acrobat Reader.
So, I decide to accomplish this through "Acrobat Control for ActiveX".
Here is my code snippet,

#--------
>>> from win32com.client import Dispatch
>>> pdf = Dispatch('PDF.PdfCtrl.5')
>>> pdf
<win32com.gen_py.Acrobat Control for ActiveX._DPdf instance at 0x30248912>
>>> pdf.LoadFile('c:\\test.pdf')
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
  File "win32com\gen_py\CA8A9783-280D-11CF-A24D-444553540000x0x1x3.py", line 35, in LoadFile
    return self._oleobj_.InvokeTypes(2, LCID, 1, (11, 0), ((8, 0),),fileName)
com_error: (-2147418113, '\xa8a\xc3\xf8\xa9\xca\xaa\xba\xa5\xa2\xb1\xd1', None, None)


When opening the PDF file, I got above error message.
Is there any missing part that I should complete before loading PDF file ?
Can anyone help?
Thanks!

-Cox Chen




More information about the Python-win32 mailing list