[EMAIL PROTECTED] wrote: > Thanks a lot. I could find the reason for getting the exception. I am > actually using a table to print the PDF. The method takes a HashMap (with key > and value pairs) and returns a PDFTable with 2 columns - one each for the key > and value. When i add this PDFTable to the document, I get the > PDFConformanceException. It means that when i add cells to the table, it is > not using the embedded fonts by default. How do i force the table to use the > fonts specified by me? The following is the code snippet:- > > private Table makeTableFromMap(final Map map, final String component) > { > Table tab = null; > tab = new Table(NUMBER_OF_COLUMNS); > tab.setBorderWidth(1.0f); > tab.setPadding(1); > tab.setSpacing(0); > > String fieldName = component + " Field"; > String fieldValue = component + " Value"; > Paragraph fieldNamePara = new Paragraph(fieldName, grayFont); > Paragraph fieldValuePara = new Paragraph(fieldValue, grayFont); > > tab.addCell(new Cell(fieldNamePara)); > tab.addCell(new Cell(fieldValuePara)); > > tab.endHeaders(); > > if (map.keySet().size() == 0) > { > Cell c = new Cell("none"); > c.setColspan(2); > tab.addCell(c); > } > else > { > Iterator iter = map.keySet().iterator(); > while (iter.hasNext()) > { > Cell valueCell = null; > String strName = (String) iter.next(); > Object value = map.get(strName); > String strValue = null; > if (value == null) > { > strValue = ""; > } > else > { > strValue = value.toString(); > } > tab.addCell(new Cell(strName)); > if(null == valueCell) > { > tab.addCell(new Cell(strValue)); > } > else > { > tab.addCell(valueCell); > } > } > } > } > catch(BadElementException bex) > { > bex.printStackTrace(); > } > return tab; > } > > > If i comment out the above method, i do not get the exception. Any pointers > please?
Use other Cell constructors. -- This answer is provided by 1T3XT BVBA ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php