Код: Выделить всё
[..]
String xhtml = convertToXhtml(htmlContent); // memory allocation #1
iTextRenderer.setDocumentFromString(xhtml);// memory allocation #2
iTextRenderer.layout();
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
iTextRenderer.createPDF(buffer); // memory allocation #3
byte[] encoded = Base64.getEncoder().encode(buffer.toByteArray()); // memory allocation #4
String pdfAsBase64 = new String(encoded, StandardCharsets.UTF_8); // memory allocation #5
return pdfAsBase64;
Я пробовал использовать
Код: Выделить всё
OutputStream buffer = Base64.getEncoder().wrap(new ByteArrayOutputStream());
Подробнее здесь: https://stackoverflow.com/questions/791 ... tml-to-pdf