title: How to get PDF in byte[] without forming a file?
body: <p>Below is my code snippet:</p>
  
  <pre><code> try (OutputStream out = new FileOutputStream(PDF_NAME)) {
              Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out);
              TransformerFactory factory = TransformerFactory.newInstance();
              Transformer transformer = factory.newTransformer(new StreamSource(xsltFile));
              Result res = new SAXResult(fop.getDefaultHandler());
              transformer.transform(new StreamSource(IOUtils.toInputStream(xml, "UTF-8")), res);
          }
      byte[] inputFile = Files.readAllBytes(Paths.get(PDF_NAME));
      String encodedFile = Base64.getEncoder().encodeToString(inputFile);
      InventoryListSnapshot pojo = new InventoryListSnapshot(invList.getInventoryLayoutId(), invList.getProjectId(), invList.getAuthorUsername(), encodedFile);
      repository.save(pojo);
  </code></pre>
  
  <p>It used <code>xsl-fo</code> to form PDF in the file. I need to place this PDF encoded by Base64 as BLOB into DB - so I don't use the file itself. </p>
  
  <p>How can I save PDF into DB without forming a file?</p>