There's a missing endText(). Post a small pdf with the problem. Paulo
----- Original Message ----- From: "max bertolini" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Saturday, August 19, 2006 4:57 PM Subject: [iText-questions] Help on using external TTF font Hi All, I need to write on an existing PDF some text. On top and on the bottom of the page I need to write a code using an OCR-A Font. Creating a new PDF with the code gave with the example all works fine: try { PdfWriter.getInstance(document, new FileOutputStream("truetype.pdf")); document.open(); BaseFont bfComic = BaseFont.createFont("C:\\usr\\max\\Java\\netBeans\\OCR\\font\\OCRAEXT.TTF", BaseFont.IDENTITY_H, BaseFont.EMBEDDED); Font font = new Font(bfComic, 12); String text1 = "ABCDEFGHILMNOPQRSTUVZ"; String text2 = "1234567890"; document.add(new Paragraph(text1, font)); document.add(new Paragraph(text2, font)); } catch(DocumentException de) { System.err.println(de.getMessage()); } catch(IOException ioe) { System.err.println(ioe.getMessage()); } Whn I try to write on the existing PDF the code gives no error but when I open the PDF Acrobat return an error that say :"Unable to find or create the Font 'YQZMBV+OCRAExtended'" and instead of the printed char I obatain a list of points. Here an extract of my code: ..... try { PdfReader reader = new PdfReader(Configuration.TEMPLATE_FILE); PdfStamper stamp = new PdfStamper(reader, new FileOutputStream(absoluteDestPath + absoluteDestFile)); PdfContentByte content = stamp.getUnderContent(1); content.beginText (); BaseFont ocr = BaseFont.createFont("C:\\usr\\max\\Java\\netBeans\\OCR\\font\\OCRAEXT.TTF", BaseFont.IDENTITY_H, BaseFont.EMBEDDED); content.setFontAndSize (ocr, 20); content.showTextAligned (PdfContentByte.ALIGN_LEFT, "1234567890", 450, 20, 0); stamp.close(); reader.close(); } catch (IOException iOE) { throw new WorkSheetCreationException("Template File non accedibile"); } Please could someone help me on this issue? Thanks in advance. Max -------------------------------------------------------------------------------- > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 -------------------------------------------------------------------------------- > _______________________________________________ > iText-questions mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/itext-questions > ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions
