Convert .doc to .pdf

T

Thales

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
 
M

Marco Nawijn

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
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
 
T

Thales

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

Thanks for your help Marco, but it has to work on linux, not on
windows. Is possible to import this win32com on linux systems? How?

Thank you!
 
M

Marco Nawijn

Thanks for your help Marco, but it has to work on linux, not on
windows. Is possible to import this win32com on linux systems? How?

Thank you!

Nope. The win32 related packages only work on Windows systems.

Maybe Wine is an option? So running a genuine MS Office under Wine on
Linux?
Otherwise, your best bet is still OpenOffice (although you mention you
cannot use it)

Regards,

Marco
 
S

Stephen Hansen

Thanks for your help Marco, but it has to work on linux, not on
windows. Is possible to import this win32com on linux systems? How?

You should include your full requirements when you originally ask :)

That said... I think you're out of luck.

Doc's are a proprietary format. The only way to /read/ them (required to
convert them to PDF) is to get something that can understand them.
There's no readily available library that I'm aware of capable of doing
so. Certain word processing utilities have varying degrees of ability to
(depending on how old the file format is) -- with OpenOffice being the
most controllable.

So I think you either need to figure out a way to turn your "can't use
it" into a "can" or -- I'm back to out of luck :)

--

Stephen Hansen
... Also: Ixokai
... Mail: me+list/python (AT) ixokai (DOT) io
... Blog: http://meh.ixokai.io/


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.10 (Darwin)

iQEcBAEBAgAGBQJMFmCXAAoJEKcbwptVWx/lRyAIAK5bLZicC+EYrXJBid4v43Cq
NxeJ7SeOgH9OEpg7lcFd7NORJnEuOMentAiB71N3mFEOlchaP0bL/mGmORjrgyl4
Qjupznn6EJdE3oeP1C/yrXcm0DoouFSnV7Zyaq35vaSbc1PeCV7CVPKhjjJNx0Cc
lRFoU3M3M1MWd2o+5Q7Zwe2/IA8TqE593H7xEpdlgZIMwPCxMmWM92UDjPGJLWVS
Dke482WX7Kht89IWWAVIF4C79OdSUaKFndnZHgkCqlVhivAbTzYv2em/RcS9XryO
Nw1291UUK1u9rEKaNs+grFOLW2ATQ0pX7ijULKPEsqGQINBcrb+HusVWjrPJPNI=
=OuaJ
-----END PGP SIGNATURE-----
 
T

Thomas Jollans

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?

Why can't you use OpenOffice?

In my experience, there are only very few programs able to read msword
files fully and properly: MS Word itself (obviously not an option), and
OpenOffice.org (maybe your best bet)

if you're really only interested in extracting the text, there are a few
tools that you could hook into - "wv" (for word view) springs to mind.

-- Thomas
 
C

Colin J. Williams

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

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
 
D

Dotan Cohen

Why can't you use OpenOffice?

This is the real question. OOo can even be installed on a machine with
no video card and run as a service in order to convert documents. The
OP might also be interested in this gem from a prominent Wine dev:
http://dag.wieers.com/home-made/unoconv/

Any answer to the question will depend on why the OP cannot run OOo,
and most likely the answer will be a fix for how to in fact run it
anyway (or MSO).
 
S

sharon hill

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

Converting a word document into a PDF has become so easy. Recently, I
have found a site aafter.com, which enables me to do this with just
some clicks and at free of cost. I simply need to type pdf: followed
by the source version of the html file, or word file (saved as html).
Or, I can just paste the word doc after typing pdf: in the search box
and press enter. I don't need to download any software. You can try
this.
 

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

No members online now.

Forum statistics

Threads
474,265
Messages
2,571,069
Members
48,771
Latest member
ElysaD

Latest Threads

Top