When I try to save to stream in XLSX format (from Pdf) ti returns 0 bytes. The same document saves fine to a file (which I can then read in and convert to a stream so I have a workaround but it is messy).
Has this been seen before.
- Code: Select all
InputStream is = dataContext.getStream(i);
Properties props = dataContext.getProperties(i);
PdfDocument pdf = new PdfDocument(is);
os = new ByteArrayOutputStream();
pdf.saveToStream(os, FileFormat.XLSX); // this doesn't work
pdf.saveToFile("work/yyy.xlsx", FileFormat.XLSX) // this does work
DataFormatter formatter = new DataFormatter(Locale.default);
File file = new File("work/yyy.xlsx");
Workbook wb = WorkbookFactory.create(file);
List sheetList = wb.sheets;
StringBuilder sb = new StringBuilder();