On 14-Jun-10 10:01 AM, Marco Nawijn wrote:
On 14 jun, 13:19, Thales<thales....@gmail.com>  wrote:
Good morning,

I need to convert some files from .doc to .pdf. I've googled it a
little bit and all the solutions I've found used the OpenOffice API,
but I can't use it.

Anybody knows a library that I can use to do it?

Thanks

What about using the win32 API and use the free  PDFCreator (http://
sourceforge.net/projects/pdfcreator/) PDF printer?

This should be very simple (code untested, but should be roughly OK):
- Instantiate MS/Word application
   >>  from win32com.client import Dispatch
   >>  app = Dispatch('Word.Application')
- Open your document
   >>  doc = app.Documents.Open("demo.doc")
- Print to PDF
   >>  app.ActivePrinter = "PDFCreator"
   >>  app.PrintOut(....)

The PrintOut call is a little tricky. I normally try to decode and
guess the Python call from the corresponding VisualBasic code I record
with the macro recording facility. I know there are more sophisticated
methods out there, but I never tried them.

Regards,

Marco
Or you could download and use OpenOffice, if there are few files to convert.

Colin W

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to