title: Convert word to pdf java
body: <p>I'm trying convert word to pdf, my code is:</p>
  
  <pre><code>public static void main(String[] args) {
      try  {
          XWPFDocument document = new XWPFDocument();
          document.createStyles();
          XWPFParagraph paragraph = document.createParagraph();
          XWPFRun title = paragraph.createRun();
          title.setText("gLETS GO");
  
          PdfOptions options = PdfOptions.create();
          OutputStream out = new FileOutputStream(new File("C:/Users/pepe/Desktop/DocxToPdf1.pdf"));
          PdfConverter.getInstance().convert(document, out, options);
          System.out.println("Done");
      } catch (Exception e) {
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>I'm getting error:</p>
  
  <pre><code>fr.opensagres.poi.xwpf.converter.core.XWPFConverterException: org.apache.xmlbeans.XmlException: error: Unexpected end of file after null
  at fr.opensagres.poi.xwpf.converter.pdf.PdfConverter.doConvert(PdfConverter.java:71)
  at fr.opensagres.poi.xwpf.converter.pdf.PdfConverter.doConvert(PdfConverter.java:39)
  
  Caused by: org.apache.xmlbeans.XmlException: error: Unexpected end of file 
  </code></pre>
  
  <p>I have tried other solutions but doesnt works. I create a java project, if someone can help me or other way to do</p>