
There are lots of additional features which we may document in later articles… The –convert-to parameter can take any filetype as a parameter (ie txt for Office to Text, HTML for Office to HTML), etc. Java.io.DataOutputStream dos = new java.io.DataOutputStream(pqShell.getOutputStream()) ĭos.writeBytes("cd " + userInputDirPath + "\n") String shellCommand = "libreoffice -headless -convert-to pdf " + fileName Process pqShell = Runtime.getRuntime().exec("sh") LibreOffice has several APIs (including Java) or you can just call it as an external process with this code in Java. We get to see a lot of PDF files and the PDF files created by LibreOffice are generally very good. Will turn the Word file myFile.docx into a PDF file. So libreoffice -headless -convert-to pdf myFile.docx Secondly, it does not need a user to run it – the software can be called from your programs as a library. Firstly, it is cross-platform so it will run on Linux and OS X boxes and not just Windows. LibreOffice has TWO very useful features.

They are both very similar with slightly different strengths and weaknesses (and both are free so try both yourself and choose). It is a version of the Open Source library OpenOffice which has excellent support for Word, PowerPoint and other office file formats. One option is to use Microsoft Office but there is an alternative that is cross-platform and free – LibreOffice. Microsoft Office files are an industry standard and lots of people want to convert them into PDF or HTML5 or SVG. Septem1 min read Office to PDF, HTML5, and SVGĪs this is a question we get asked a lot at IDRsolutions, I decided to write a blog article on the topic, which may well develop into a series… How to convert Microsoft Office documents to PDF, HTML5 or SVG

He has an MA in Medieval History and a passion for reading. Mark Stephens Mark has been working with Java and PDF since 1999 and is a big NetBeans fan.
