Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there a command-line interface only package to convert Microsoft Office files to PDF? Specifically, I need to be able to export

  • doc/docx (Word),
  • ppt/pptx (PowerPoint),
  • xls/xlsx (Excel), and
  • vsd/vsdx (Visio).

I am aware that an installation of LibreOffice comes with a CLI to convert documents, but it does not appear to to support Visio diagrams. Is there a package that does?


Ideally I'd like a solution that works on Linux, but I could find a way to use Windows if it would be far more practical. What I will very likely not have is a license to any MS products.

share|improve this question
    
what version of office? –  Keltari Aug 21 '13 at 13:20
    
@Keltari I'm not sure. I don't think I will be working with anything pre-2003, but I think 2007 is a safe baseline. –  Sean Allred Aug 21 '13 at 13:24
1  
I dont have an office 2007 app to see, but check to see if you can save as PDF from the Save As. If so, then you can write a VBScript to convert to PDF. I know this can be done for 2010 and up. –  Keltari Aug 21 '13 at 13:27
    
@Keltari I believe every version from 2003 on supports export as PDF. 2007 confirmed. Note though that I do not have a version of Office available, as I mentioned in the bit @-terdon edited out... –  Sean Allred Aug 21 '13 at 13:30
1  
Since 4.0, LO has a Visio import filter‌​. I never used it myself, so i can't tell how "powerful" it is, but it may be worth a try. –  tohuwawohu Aug 21 '13 at 15:01

2 Answers 2

You can use powershell. You can write your own, but often MS already has such scripts written for you, because all recent office supports powershell and thus can be operated on by powershell scripts. Here are some examples, and you can find more in technet.

http://gallery.technet.microsoft.com/office/Script-to-convert-Word-f702844d

http://blogs.technet.com/b/heyscriptingguy/archive/2010/09/06/save-a-microsoft-excel-workbook-as-a-pdf-file-by-using-powershell.aspx

first, you probably can read this:

http://technet.microsoft.com/en-us/scriptcenter/dd742371.aspx

share|improve this answer

try setup a PDF printer and make it default, then

Winword.exe some.doc /q /n /mFilePrintDefault /mFileExit

share|improve this answer
    
Per the original question, I do not have a license for (therefore no copies of) any Microsoft Office products. winword.exe is definitely a Microsoft Office product. –  Sean Allred Aug 21 '13 at 16:11
    
just saw the case, bare in mind that you probably will suffer formatting lost in most case for any method other than using a actual MS word to print to "PDF", even if print with a MS word viewer suffer formatting lost. –  Antony Lee Aug 22 '13 at 14:26
    
I realize that, and it's something we took under consideration before embarking on this. –  Sean Allred Aug 22 '13 at 14:43
    
alternatively, you can simply unzip it, then grep the document.xml, and use sed to get all the text between <w:t> and </w:t> –  Antony Lee Aug 22 '13 at 14:59
    
that's how we read a docx in unix. –  Antony Lee Aug 22 '13 at 15:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.