I want to extract a certain part from the site and make a pdf document out of this piece. I create a document for example from the official website iText:
PdfPTable table = new PdfPTable(1); PdfPCell cell = new PdfPCell(); ElementList allElements = XMLWorkerHelper.parseToElementList(html, null); for (Element element : allElements) { cell.addElement(element); } table.addCell(cell); document.add(table); document.close(); The document is created, but Russian words are not displayed. Partially managed to solve this way:
BaseFont baseFont = BaseFont.createFont(FONT_LOCATION, ENCODING, BaseFont.EMBEDDED); Paragraph paragraph = new Paragraph(title, new Font(baseFont, 18)); But this is for a single element, and the XMLWorkerHelper.parseToElementList() method returns the already created list.