@vyacheslav.deryushev after converting html to pdf/docx the document have alignment issue. Attaching the sample html string and providing the code also.
For pdf conversion:
InputStream targetStream = new ByteArrayInputStream(htmlString.getBytes(StandardCharsets.UTF_8));
Document document = new Document(targetStream);
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.setAdditionalTextPositioning(true);
pdfSaveOptions.setPageMode(PdfPageMode.FULL_SCREEN);
pdfSaveOptions.setSaveFormat(SaveFormat.PDF);
document.save(byteArrayOutputStream, pdfSaveOptions);
pdfBytes = byteArrayOutputStream.toByteArray();
for docx conversion:
try (var byteArrayOutputStream = new ByteArrayOutputStream()) {
InputStream targetStream = new ByteArrayInputStream(htmlString.getBytes(StandardCharsets.UTF_8));
Document document = new Document(targetStream);
document.save(byteArrayOutputStream, SaveFormat.DOCX);
docBytes = byteArrayOutputStream.toByteArray();
}