Hi again IText guys,

My last message wasn't as helpful as it could be becuase the font and the dialog
box were ripped out. I have investigated further and changed the encoding of my
font to BaseFont.CP1252 (see program below - You were right Christer) but I still 
always get the dialog below when I open the generated doc in acrobat 6.

    
-----------------------------------------------------------------------------------------------------------------------
    | Cannot extract the embedded font 'SPIZDL+UBSWealthMgmt', some characters |
    | may not display or print correctly.                                              
                      |
    |                                                                                  
                  -------------    |
    |                                                                                  
                  |   OK   |     |
    |                                                                                  
                  -------------     |
    
------------------------------------------------------------------------------------------------------------------------

The font is in use without any problems all over the place in my office (including via 
itext 
in unembedded mode) but I can't embed it - surely this should be easy?!

Yours hopefully
Mike    ([EMAIL PROTECTED])


import java.io.FileOutputStream;
import java.io.IOException;

import com.lowagie.text.*;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfWriter;

public class Chap0902 {
    
    public static void main(String[] args) {
        
        // step 1: creation of a document-object
        Document document = new Document();
        
        try {
            // step 2:
            // we create a writer that listens to the document
            // and directs a PDF-stream to a file
            PdfWriter.getInstance(document, new FileOutputStream("Chap0902.pdf"));
            
            // step 3: we open the document
            document.open();
/*            
            FontFactory.register("c:\\winnt\\fonts\\UBSWealth.ttf");
            Font wmFont = FontFactory.getFont
                ("UBS Wealth Mgmt", BaseFont.CP1252, BaseFont.EMBEDDED, 24);
            BaseFont wmBaseFont = wmFont.getBaseFont();
            System.out.println("Encoding = "+wmBaseFont.getEncoding());
*/            
            // step 4: we add content to the document
            //BaseFont bfComic = BaseFont.createFont("c:\\winnt\\fonts\\comicbd.ttf", 
BaseFont.CP1252, BaseFont.EMBEDDED);
            BaseFont bfComic = BaseFont.createFont("c:\\winnt\\fonts\\UBSWealth.ttf", 
BaseFont.CP1252, BaseFont.EMBEDDED);
            //bfComic.setSubset(false);
                        
            Font font = new Font(bfComic, 12);
            //Font font = new Font(wmBaseFont, 12);
            String text1 = "a b c";
            document.add(new Paragraph(text1, font));
        }
        catch(DocumentException de) {
            System.err.println(de.getMessage());
        }
        catch(IOException ioe) {
            System.err.println(ioe.getMessage());
        }
        
        // step 5: we close the document
        document.close();
    }
}



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to