Hello Robert. I had this same dilemna last week. It took me almost 3
freakin days to figure this out. Anyway, to save you all the trouble
in the world ;) here's how you should do it


Make sure that your XML is written in UTF-8

E.g.
        PrintWriter write = new PrintWriter(new OutputStreamWriter(new
FileOutputStream(xmlFile), "UTF-8"));

Then your xml code should look like this

E.g. (this displays chinese characters)

        <?xml version="1.0" encoding="UTF-8"?>
        <!DOCTYPE ITEXT SYSTEM
"http://www.lowagie.com/iText/itext.dtd";>
        <body>
                <font face="STSong-Light"
encoding="UniGB-UCS2-H">CHINESE_CHARACTERS_HERE_IN_UNICODE</font>
        </body>

And my xml definition in the tagmap.xml for <body> and <font> are as
follows

        <tag name="itext" alias="body" />
        
        <tag name="chunk" alias="font">
                <attribute name="size" alias="size" />
                <attribute name="font" alias="face" />
                <attribute name="color" alias="color" />
                <attribute name="style" alias="style" />
                <attribute name="leading" alias="leading" />
                <attribute name="align" alias="align" />
        </tag>



-----Original Message-----
From: Paulo Soares [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 22, 2003 6:00 AM
To: Robert Oracle; [EMAIL PROTECTED]
Subject: Re: [iText-questions] XML & TTF Fonts



----- Original Message -----
From: "Robert Oracle" <[EMAIL PROTECTED]>
To: "Paulo Soares" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Monday, July 21, 2003 19:19
Subject: Re: [iText-questions] XML & TTF Fonts


> Hi
> I'm sorry, but this doesn't work.
> When compiling it throws exception:
>
> ExceptionConverter: ExceptionConverter:
> com.lowagie.text.DocumentException:
> Identity-H
>  at
org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:524)
>  at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
> :
> :
>
> If I put UTF-8 or unicode instead, it compiles ok, and still does
not 
> show special characters.

That's the font encoding, not the xml file encoding.

>
> But while experimenting I concluded that there must be some problem
in 
> Acrobat Reader together with fonts while showing those special 
> characters, because it
> normaly shows characters up to char(255), but doesnot show
char(256). So
> I will
> explore in this way ...
>

There are more ways to represent fonts than just the 256 characters.

Best Regards,
Paulo Soares

> Thanx for advices.
> Robert
>
>
> On Mon, 21 Jul 2003 at 17:33:46, Paulo Soares wrote:
>
> > You'll need:
> >
> > <paragraph font="Dwarf Runes" encoding="Identity-H">
> >
> > Best Regards,
> > Paulo Soares
> >
> > ----- Original Message -----
> > From: "Robert Oracle" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Monday, July 21, 2003 12:41
> > Subject: Re: [iText-questions] XML & TTF Fonts
> >
> >
> > > Thanx!
> > > This helped me with getting the font inside PDF.
> > > But I have one more problem, because I want to print special 
> > > unicode characters.
> > >
> > > In XML I have
> > > <?xml version="1.0" encoding="UTF-8" ?>
> > > and in this line I print characters:
> > > <paragraph font="Dwarf Runes">Special
> TTF:D:&#272;:S:&#352;.</paragraph>
> > > Special character '352' is printed ok, but I dont see character
> '272'.
> > >
> > > if I create HTML from same XML, the character are printed ok. I 
> > > allso checked TTF with Character Map utility and characters are
> there.
> > >
> > > Any further idea on this subject.
> > > Thanx.
> > > Robert
> > >
> > > On Mon, 21 Jul 2003 at 11:59:27, Paulo Soares wrote:
> > >
> > > > Register the fonts with FontFactory and call them by name as 
> > > > they
> > > appear in
> > > > windows.
> > > >
> > > > Best Regards,
> > > > Paulo Soares
> > > >
> > > > ----- Original Message -----
> > > > From: "Robert Oracle" <[EMAIL PROTECTED]>
> > > > To: <[EMAIL PROTECTED]>
> > > > Sent: Monday, July 21, 2003 9:54
> > > > Subject: [iText-questions] XML & TTF Fonts
> > > >
> > > >
> > > > > Hi
> > > > > I am succesfuly creating PDF from an XML file.
> > > > > Using different system fonts in document is also ok. The 
> > > > > problem that I have is, when I want to use different True
> Type
> > > > > Fonts, which
> > > > > are all stored on my computer.
> > > > > What is the corect way to tell iText (through XML) to use
> something
> > > > > like "F:\MyTrueTypeFont.ttf" instead of system fonts? Some 
> > > > > quick answers would be great. Thanx.
> > > > > Robert
> > > > >
> > > > > ____________________
> > > > > http://www.email.si/
> > > > >
> > > > >
> > > > >
> > > > > -------------------------------------------------------
> > > > > This SF.net email is sponsored by: VM Ware
> > > > > With VMware you can run multiple operating systems on a
single
> > > machine.
> > > > > WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual 
> > > > > machines
> at
> > > the
> > > > > same time. Free trial click here:
> > > http://www.vmware.com/wl/offer/345/0
> > > > > _______________________________________________
> > > > > iText-questions mailing list 
> > > > > [EMAIL PROTECTED]
> > > > > https://lists.sourceforge.net/lists/listinfo/itext-questions
> > > > >
> > >
> > >
> > >
> > > ____________________
> > > http://www.email.si/
> > >
> > >
> > >
> > > -------------------------------------------------------
> > > This SF.net email is sponsored by: VM Ware
> > > With VMware you can run multiple operating systems on a single
> machine.
> > > WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines

> > > at
> the
> > > same time. Free trial click here:
> http://www.vmware.com/wl/offer/345/0
> > > _______________________________________________
> > > iText-questions mailing list
[EMAIL PROTECTED]
> > > https://lists.sourceforge.net/lists/listinfo/itext-questions
> > >
>
>
>
> ____________________
> http://www.email.si/
>



-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single
machine. WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual
machines at the same time. Free trial click here:
http://www.vmware.com/wl/offer/345/0
_______________________________________________
iText-questions mailing list [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.502 / Virus Database: 300 - Release Date: 7/18/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.502 / Virus Database: 300 - Release Date: 7/18/2003
 


-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to