You have to register the fonts in DefaultFontMapper.

Paulo

----- Original Message ----- 
From: "ssinai" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Sunday, August 05, 2007 9:41 PM
Subject: [iText-questions] Font question


>
> I've been doing iText for a whole 2 days.  I was fiddling around with an
> example involving converting a Swing  JTable to pdf, and have been trying 
> to
> figure out how to get the font that's in the table to show up correctly in
> pdf.  While the type 1 fonts seem to show up correctly, I'm having 
> problems
> with lots of different true type fonts. For testing purposes, I'm using
> Papyrus, Font.PLAIN, size 12 in the table, but it's not showing up in the
> pdf.  A plain, old font is showing up in the pdf, instead.
>
> Is there a way, with the code given below, to get the pdf to display the
> Papyrus font in the table? Or is this the wrong approach in the first 
> place?
>
>
> public void createPdf (JTable table) {
> Document document = new Document();
> try {
> PdfWriter writer;
> writer = PdfWriter.getInstance(document,
> new FileOutputStream("Table.pdf"));
> document.open();
> PdfContentByte cb = writer.getDirectContent();
> PdfTemplate tp = cb.createTemplate(520, 100);
> Graphics2D g2;
> g2 = tp.createGraphics(520, 100);
> table.print(g2);
> g2.dispose();
> cb.addTemplate(tp, 48, 100);
>
> } catch (Exception e) {
> System.err.println(e.getMessage());
> }
> document.close();
> }
>
> Thanks,
> Steve Sinai


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to