Convert to PDF in base64 stream

Hello, is it possible to generate pdf output in form of base64 stream in program without saving in local folder?

@danishPersys

Please take a look how to store result of conversion in stream. After that you could do the base64 encoding:

// Java code
WordProcessingLoadOptions loadOptions = new WordProcessingLoadOptions();
Converter converter = new Converter("input.docx", loadOptions);
try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream()) {
      converter.convert(() -> byteArrayOutputStream, new PdfConvertOptions());
      // do something with byteArrayOutputStream (e.g. convert byteArrayOutputStream to Base64 stream)
} catch (IOException e) {
      throw new RuntimeException(e);
}
1 Like