[what goes here?] = "creditcard"
Careful with the encoding, you're using cp1250 and if you really require
cp1252 the results will be different. Other option is to get BaseFont
directly and not use FontFactory. Failing all this please post the font, the
code and your expectations.
Paulo
----- Original Message -----
From: "Jason Berk" <
jberk@...>
To: "Post all your questions about iText here"
<
itext-questions@...>
Sent: Friday, June 26, 2009 10:28 PM
Subject: [iText-questions] embedding ttf fonts
Hey guys,
I've read the chapter on using fonts repeatedly and I'm still really
confused.
I have three TTF fonts that are custom (they contain logos). Obviously,
I need to embed these into the PDF. I also need to be able to get their
"BaseFont" so I can position them absolutely.
I seem to be registering my fonts correctly:
logger.info("registering required fonts:");
String[] fonts = new String[]{"CREDITCARD.ttf",
"OCRAEXT.ttf", "PURDUE.ttf", "SCORECARD.ttf"};
for(String font:fonts){
logger.info("fonts/" + font);
FontFactory.register("fonts/"+font);
}
for (Iterator i =
FontFactory.getRegisteredFonts().iterator(); i.hasNext(); ) {
System.out.println((String) i.next());
}
Gives me this:
main 16:43:06,714 INFO Driver (<init>:18) - registering required fonts:
main 16:43:06,714 INFO Driver (<init>:21) - fonts/CREDITCARD.ttf
main 16:43:06,761 INFO Driver (<init>:21) - fonts/OCRAEXT.ttf
main 16:43:06,761 INFO Driver (<init>:21) - fonts/PURDUE.ttf
main 16:43:06,761 INFO Driver (<init>:21) - fonts/SCORECARD.ttf
times-italic
helvetica-bold
courier-boldoblique
ocraextended <--- mine
helvetica-boldoblique
helvetica
creditcard <--- mine
courier-bold
courier-oblique
zapfdingbats
scorecard <--- mine
times-roman
symbol
purdue <--- mine
helvetica-oblique
times-bold
courier
times-bolditalic
ocr a extended
now that it's registered I need to do something like this:
BaseFont myFont = BaseFont.createFont([what goes here?],
BaseFont.CP1250, true);
PdfTemplate logo = PdfTemplate.createTemplate(..some writer.., 115f,
72f);
logo.beginText();
logo.moveText(1, 20);
logo.setFontAndSize(pefcuFont, 14);
logo.setColorFill(PEFCU_LOGO_RED);
logo.showText("A");
logo.endText();
logo.beginText();
logo.moveText(1, 20);
logo.setFontAndSize(pefcuFont, 14);
logo.setColorFill(PEFCU_LOGO_GRAY);
logo.showText("B");
logo.endText();
help!
------------------------------------------------------------------------------
_______________________________________________
iText-questions mailing list
iText-questions@...
https://lists.sourceforge.net/lists/listinfo/itext-questionsBuy the iText book:
http://www.1t3xt.com/docs/book.phpCheck 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/