List of usage examples for org.apache.pdfbox.pdmodel.font.encoding WinAnsiEncoding INSTANCE
WinAnsiEncoding INSTANCE
To view the source code for org.apache.pdfbox.pdmodel.font.encoding WinAnsiEncoding INSTANCE.
Click Source Link
From source file:at.gv.egiz.pdfas.lib.impl.stamping.pdfbox2.PDFBoxTable.java
License:EUPL
private void normalizeContent(Table abstractTable) throws PdfAsException { int rows = abstractTable.getRows().size(); for (int i = 0; i < rows; i++) { ArrayList<Entry> row = this.table.getRows().get(i); for (int j = 0; j < row.size(); j++) { Entry cell = (Entry) row.get(j); switch (cell.getType()) { case Entry.TYPE_CAPTION: case Entry.TYPE_VALUE: String value = (String) cell.getValue(); //Check if the used value font supports all characters in string PDFont f = null;//from w w w . j a v a 2 s .com try { if (valueFont != null) { f = valueFont.getFont(); f.getStringWidth(value); } } catch (IllegalArgumentException | IOException e) { if (f != null) { logger.warn( "Font " + f.getName() + " doesnt support a character in the value " + value); } cell.setValue( PDFTextNormalizationUtils.normalizeText(value, WinAnsiEncoding.INSTANCE::contains)); } break; } } } }