Hi, I'm doing some tests for exporting some Swing components to PDF using iText. I have some problems with Unicode strings which don't appear in the PDF. I saw a lot of Internet pages with some different approaches to correct this but I didn't manage to find a clean portable way to do that. Do you have any advice to do that ? For example, is there any way to create a BaseFont from a font name/family or from a java.awt.Font instance rather than a file path?
I tested: ------- BaseFont unicode = BaseFont.createFont("c:/windows/fonts/arialuni.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED); FontMapper fm = new FontMapper() { @Override public Font pdfToAwt(BaseFont arg0, int arg1) { // TODO Auto-generated method stub return null; } @Override public BaseFont awtToPdf(Font arg0) { // TODO Auto-generated method stub return unicode; } }; Graphics2D g2 = cb.createGraphics(documentWidth, documentHeight, fm); chart.draw(g2, drawingArea); g2.dispose(); --------- which works very nice on Windows but I need a way to do that on Linux and Mac OS too and I'd also prefer to base the rendering on the existent java.awt.Font of the Swing source components. But I didn't managed to use the java.awt.Font in iText. The java.awt.Font font family based I use is, for example, "Lucida Sans Console". At the moment, I'd see these solution which seem not very good to me : - get, in Java, the system file path equivalent to the java.awt.Font instance and pass it to iText - deploy the application with the fonts files for the 3 OS Could you tell me what would be the best approach to produce a PDF with iText, based on a java.awt.Font ? (I'm sorry, It appears to be a common question but I really didn't manage to achieve this, all the examples I found used some system file paths) Thanks in advance for any help. Sebastian -- Centre Jacques-Petit (ELLIADD, EA 4661) UFR SLHS - Université de Franche-Comté 30-32 rue Mégevand 25030 Besançon cedex 03.81.66.54.22 ------------------------------------------------------------------------------ "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE Instantly run your Selenium tests across 300+ browser/OS combos. Get unparalleled scalability from the best Selenium testing platform available Simple to use. Nothing to install. Get started now for free." http://p.sf.net/sfu/SauceLabs _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php