You may have success using WINANSI encoding and 
BaseFont.setDirectTextToByte(true). It looks like your font has a flag that 
makes it symbolic but then uses chars outside 00-ff as a symbolic font 
should do. As I don't have the font, this is my best guess.

Paulo

----- Original Message ----- 
From: "Claudia Murialdo" <[email protected]>
To: <[email protected]>
Sent: Friday, January 08, 2010 9:17 PM
Subject: Re: [iText-questions] Barcode128 PDF start and stop characters 
don´t appear


> Paulo, with reference to your response: "Maybe those characters don't 
> exist in the font or are invisible"
> I checked it and those characters do exist, I checked it using Character 
> Map of Windows, for instance the character Š in font BarCode 128 has a 
> valid symbol (which are 4 vertical bars and it is the character Latin 
> Capital Letter S With Caron U+0160 ).
>
> While debugging itext source code I see the text is encoded using this 
> line:
> PdfEncodings.ConvertToBytes(text, "symboltt"); which goes to 
> SymbolTTConversion.CharToByte  and in that function characters like Š are 
> removed:
>
>            for (int k = 0; k < len; ++k) {
>                char c = ch[k];
>                if ((c & 0xff00) == 0 || (c & 0xff00) == 0xf000) //it 
> doesn't happen for Š so it is ignored
>                    b[ptr++] = (byte)c;
>            }
>
> Why this character is ignored in that code?. It is a valid character for 
> Code128 font.
>
> Any help would be appreciated.
> Regards,
> Claudia.
>
>
>
> On Fri, Jan 8, 2010 at 4:33 PM, Claudia Murialdo 
> <[email protected]<mailto:[email protected]>> wrote:
> Hello,
> I have another example of a valid text for Barcode 128: 
> "‰A)'=_Xwè!-Wè>èè1F0èBÀ~UŠ"
> It corresponds to the string 33090729635687000113550030000017381600349594 
> converted to Barcode 128.
> It has checksum and start and stop characters. It is ok in word when I use 
> Barcode 128 font. But it is incomplete (the start and stop characters 
> don't appear) in the generated PDF.
> This is my source code:
>
>
>            Rectangle pageSize = new Rectangle(780, 525);
>            Document document = new Document(pageSize);
>
>            PdfWriter writer = PdfWriter.GetInstance(document, 
> File.OpenWrite("Test.pdf"));
>            document.Open();
>
>            PdfContentByte cb = writer.DirectContent;
>            BaseFont bf = 
> BaseFont.CreateFont(@"C:\WINDOWS\Fonts\bcode128.ttf", BaseFont.IDENTITY_H, 
> BaseFont.EMBEDDED);
>
>            cb.SetFontAndSize(bf, 50);
>            cb.BeginText();
>            cb.ShowTextAligned(Element.ALIGN_CENTER, 
> "‰A)'=_Xwè!-Wè>èè1F0èBÀ~UŠ", 200, 400, 0f);
>            cb.EndText();
>            document.Close();
>
> What do you think that could be the problem?.
> Regards,
> Claudia.
>
>
>
> On Thu, Jan 7, 2010 at 1:40 PM, Claudia Murialdo 
> <[email protected]<mailto:[email protected]>> wrote:
> Paulo, I did another test with a string of characters which has a 
> checksum, and it seems to be ok. If I write those characters in Word with 
> the "PF Barcode 128" font I see the barcode is ok (see 
> CompleteBarcode.rtf) .
> But the same string (which is in text.txt) appears incomplete in the PDF 
> generated using itext (IncompleteBarcode.pdf). The start and stop 
> characters are not visible. I'm not sure what else to try.
> What else do you think could be the problem?.
>
>
>
> On Sat, Dec 26, 2009 at 12:53 PM, Claudia Murialdo 
> <[email protected]<mailto:[email protected]>> wrote:
> Ok. Thank you. I'm going to check that.
> Regards,
> Claudia.
>
> On Wed, Dec 23, 2009 at 5:17 PM, Paulo Soares 
> <[email protected]<mailto:[email protected]>> wrote:
> Maybe those characters don't exist in the font or are invisible. If that's 
> a
> code128 font you'll also need to calculate the checksum and put another
> character or characters, it's quite complex. I don't see how this is an
> iText related problem.
>
> Paulo
>
> ----- Original Message -----
> From: "Claudia Murialdo" <[email protected]<mailto:[email protected]>>
> To: 
> <[email protected]<mailto:[email protected]>>
> Sent: Wednesday, December 23, 2009 1:54 PM
> Subject: [iText-questions] Barcode128 PDF start and stop characters don´t
> appear
>
>
>> Hello,
>> I'm using itext to generate a PDF document with a BarCode128. The problem
>> is that the start and stop characters (characters 135 and 138) are not
>> printed. It works fine if I do it using iTextSharp.text.pdf.Barcode128
>> instead of PdfContentByte using the true type font.
>> This is the code:
>>
>>    public static void Main(String[] args)
>>    {
>>        Rectangle pageSize = new Rectangle(780, 525);
>>        Document document = new Document(pageSize);
>>
>>        PdfWriter writer = PdfWriter.GetInstance(document,
>> File.OpenWrite("Test.pdf"));
>>        document.Open();
>>
>>        PdfContentByte cb = writer.DirectContent;
>>        BaseFont bf = 
>> BaseFont.CreateFont(@"C:\WINDOWS\Fonts\Bcode128.ttf",
>> BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
>>        cb.SetFontAndSize(bf, 50);
>>        cb.BeginText();
>>        cb.ShowTextAligned(Element.ALIGN_CENTER, "‡BARCODE7Š", 200, 350,
>> 0f); //Character ‡ and Š don't appear in the generated PDF document
>>
>>        cb.EndText();
>>
>>        document.Close();
>>    }
>>
>> I tried with the unicode numbers (I tried with this string:
>> "\u01c2BARCODE7\u0160") but it is the same.
>> Also, bf.CharExists('‡') returns false, and the same for
>> bf.CharExists('Š'). I guess it is related with the problem.
>>
>> How can I get those start and stop characters printed using
>> PdfContentByte?.
>> Thanks in advance.
>> Claudia.


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check 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/

Reply via email to