Convert doc or docx to pdf

Does anyone know if it’s possible or how I might go about converting an MS Word document (doc or docx) into a pdf document?

This will be done from a web app so MS Office will not be present on the server. Is there a plugin available that could make this possible?

What’s the OS of the server?

you could script microsoft office to print to pdf automatically.

Or if you don’t need every feature in word files, you can use NSAttributedString on Mac.
In our plugin in the NSAttributedStringMBS class, we have a function to make a PDF directly.

It will be on windows server 2012.

The server doesn’t have MS Office on it and I’ve been assured it never will.
I suppose what I need is a windows solution that will produce a pdf that is an accurate representation of the original word document.

You may want to check out some of those web services which convert doc to pdf.

Thanks Christian, That hadn’t occurred to me. I will take a look.

Although that may present me with another option of creating a web service on another machine that does have MS word on it and using that to do the conversions.

lowriter can be used as a command line tool (lowriter is a part of LibreOffice)

lowriter --convert-to pdf *.doc

We use LibreOffice too, but here the utility we use is soffice, part of the package. That’s available on Mac and Linux.

The version we use is:

/path/to/soffice --headless --convert-to pdf /path/to/word/doc

You can also specify --outdir /path/to/output/folder to have it store it somewhere else. So far, this has been flawless.

Here’s the link for the Windows 64 version: