Hello, i have to create a PDF from JTextPane with formatted StyledDocument. It is very easy and works almost without Problems. But in some cases (Tahoma & font size 14) the underline or stroke-line is too short. Is this a bug or is there another way to convert the formatted text from a JTextPane to PDF?
Sample Code; SimpleAttributeSet attributes = new SimpleAttributeSet(); attributes.addAttribute(StyleConstants.Underline, Boolean.TRUE); attributes.addAttribute(StyleConstants.FontFamily, "Tahoma"); attributes.addAttribute(StyleConstants.FontSize, 14); JTextPane textPane = new JTextPane(); textPane.setText("Glasiertes Schweinefilet"); StyledDocument doc = textPane .getStyledDocument(); doc.setCharacterAttributes(0, textPane.getText().length(), attributes, false); PdfTemplate tp = pdfWriter.getDirectContent().createTemplate(textPane.getWidth(), textPane.getHeight()); Graphics2D g2 = tp.createGraphicsShapes(textPane.getWidth(), textPane.getHeight()); textPane.print(g2); g2.dispose(); Image image = Image.getInstance(tp); titleImage.setAbsolutePosition(xPos, yPos); pdfWriter.getDirectContent().addImage(titleImage); http://old.nabble.com/file/p27803836/test.jpg -- View this message in context: http://old.nabble.com/Problem-creating-PDF-from-JTextPane-with-underlined-text-tp27803836p27803836.html Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ 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 Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/