title: Trying to make simple PDF document with Apache poi
body: <p>I see the internet is riddled with people complaining about apache's pdf products, but I cannot find my particular usecase here. I am trying to do a simple Hello World with apache poi. Right now my code is as follows:</p>
  
  <pre><code>public ByteArrayOutputStream export() throws IOException {
      //Blank Document
      XWPFDocument document = new XWPFDocument();
  
      //Write the Document in file system
      ByteArrayOutputStream out = new ByteArrayOutputStream();;
  
      //create table
      XWPFTable table = document.createTable();
      XWPFStyles styles = document.createStyles();
      styles.setSpellingLanguage("English");
      //create first row
      XWPFTableRow tableRowOne = table.getRow(0);
      tableRowOne.getCell(0).setText("col one, row one");
      tableRowOne.addNewTableCell().setText("col two, row one");
      tableRowOne.addNewTableCell().setText("col three, row one");
  
      //create second row
      XWPFTableRow tableRowTwo = table.createRow();
      tableRowTwo.getCell(0).setText("col one, row two");
      tableRowTwo.getCell(1).setText("col two, row two");
      tableRowTwo.getCell(2).setText("col three, row two");
  
      //create third row
      XWPFTableRow tableRowThree = table.createRow();
      tableRowThree.getCell(0).setText("col one, row three");
      tableRowThree.getCell(1).setText("col two, row three");
      tableRowThree.getCell(2).setText("col three, row three");
  
      PdfOptions options = PdfOptions.create();
      PdfConverter.getInstance().convert(document, out, options);
      out.close();
      return out;
  }
  </code></pre>
  
  <p>and the code that calls this is:</p>
  
  <pre><code>    public ResponseEntity&lt;Resource&gt; convertToPDFPost(@ApiParam(value = "DTOs passed from the FE" ,required=true )  @Valid @RequestBody ExportEnvelopeDTO exportDtos) {
  
          if (exportDtos.getProdExportDTOs() != null) {
              try {
                  FileOutputStream out = new FileOutputStream("/Users/kornhaus/Desktop/test.pdf");
                  out.write(exporter.export().toByteArray());
                  out.close();
              } catch (IOException e) {
                  e.printStackTrace();
              }
              return new ResponseEntity&lt;Resource&gt;(responseFile, responseHeaders, HttpStatus.OK);
          }
  
          return new ResponseEntity&lt;Resource&gt;(HttpStatus.INTERNAL_SERVER_ERROR);
      }
  
  }
  </code></pre>
  
  <p>On this line here: <code>out.write(exporter.export().toByteArray());
  </code> the code throws an exception: </p>
  
  <pre><code>org.apache.poi.xwpf.converter.core.XWPFConverterException: java.io.IOException: Unable to parse xml bean
  </code></pre>
  
  <p>I have no clue what's causing this, where to even look for this kind of documentation. I have been coding a decade plus and never had such difficulty with what should be a simple Java library. Any help would be great.</p>