Converting office files to PDF

  • Thread starter Goermezer, Mustafa (PROSTE)
  • Start date
G

Goermezer, Mustafa (PROSTE)

Hello,

with CoInitializeEx it is possible for word, excel or powerpont to run in
multiple instances. So you can build a webbased converter to convert Office
documents with spyce and mod_python (I have tested it, it runs fine !):

Example for multiple instances:

pythoncom.CoInitializeEx(pythoncom.COINIT_APARTMENTTHREADED)
myWord = win32com.client.DispatchEx('Word.Application')
myWord.Application.ActivePrinter="Printer name"
myDoc = myWord.Documents.Open("filename.doc", False, False, False)#please
see VBAWD10.CHM in Office directory
myDoc.Saved=1
myWord.PrintOut(True, False, 0, "postscriptfile.ps") ##please see
VBAWD10.CHM in Office directory
while myWord.BackgroundPrintingStatus > 0:
time.sleep(1)
myDoc.Close()
myWord.Quit()
del myDoc
del myWord
Ghost() #ghostscript-command to convert created postscript file to PDF
pythoncom.CoUninitialize()

A ready script to convert files in commandline is on my homepage
www.goermezer.de.

Python rulez !!!

Mustafa
 
P

Peter Maas

Goermezer said:
with CoInitializeEx it is possible for word, excel or powerpont to run in
multiple instances. So you can build a webbased converter to convert Office
documents with spyce and mod_python (I have tested it, it runs fine !): [...]
Ghost() #ghostscript-command to convert created postscript file to PDF
pythoncom.CoUninitialize()

A ready script to convert files in commandline is on my homepage
www.goermezer.de.

Just for info: OpenOffice 1.1 can be started as a server, is Python
scriptable and has a builtin PDF Export. See for example

http://delta-flyer.musc.edu/ooconvert/

This solution fas the advantage to be available not only on the
Windows platform.

Mit freundlichen Gruessen,

Peter Maas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top