As suggested, I added all the English and Arabic text to a Paragraph and then
set
the alignment to Element.ALIGN_LEFT (see code sample below).  However, the 
mix English and Arabic text output on the same line is still not correct.
The Arabic 
text is not getting rendered correctly. 

I believe the problem is that English has a run direction of Left-to-Right
and Arabic text 
has a run direction of Right-to-Left, but there is no way of specifying this
for each 
piece of Arabic or English text added to the Paragraph.

Am I missing something here ?

            Paragraph para = new Paragraph();
            para.add(new Phrase("Author(s): ", unicodeFont));
            para.add(new Phrase(english_author_name_str1+"/ ",
unicodeItalicFont));
            para.add(new Phrase(arabic_author_name_str1+", ",
unicodeItalicFont)); 
            ....
            para.add(new Phrase(english_author_name_strN+"/ ",
unicodeItalicFont));
            para.add(new Phrase(arabic_author_name_strN+", ",
unicodeItalicFont));
            para.setAlignment(Element.ALIGN_LEFT);
            columnText.addText(para);
            columnText.go()


David



Paulo Soares wrote:
> 
> You can mix English and Arabic text in the same line and both will work
> correctly. You may use the alignment LTR. Both texts must be in the same
> Paragraph.
> 
> Paulo 
> 
>> -----Original Message-----
>> From: [EMAIL PROTECTED] 
>> [mailto:[EMAIL PROTECTED] On 
>> Behalf Of dayvidpow
>> Sent: Wednesday, December 05, 2007 1:25 AM
>> To: [email protected]
>> Subject: Re: [iText-questions] Phrase containing 
>> Chunks/Phrase with multiple Run Directions
>> 
>> 
>> The proposed 2 column solution will not work for my special situation.
>> Basically, I am reading some journal metadata from xml files 
>> and using this 
>> data to generate and insert a coverpage into existing PDFs.
>> 
>> The journal metadata is of varying length and in various languages.
>> Some of the metadata contains text in 2 different languages with
>> 2 different RUN DIRECTION eg. English and Arabic or English 
>> and Hebrew.
>> So for example: a journal article may have multiple authors -
>> some with English names and some with Arabic names. So the 
>> output should be:
>> 
>> Title: <english_article_title> / <arabic_article_title>
>> Author(s): <englishname>, <english_name>, <arabic_name>,
>> <arabic_name>...<arabic_name>
>> 
>> Now in these special cases i am trying to output the English 
>> portion of the
>> text
>> and the Arabic portion of the text together on the same line with auto
>> wrapping 
>> and in the proper order. The data varies in length therefore 
>> i cannot use
>> absolute 
>> positioning (showTextAligned, PdfPTable, etc).  
>> 
>> I don;t know , but maybe this cannot be accomplished using iText ?
>> 
>> David
>> 
>> 
>> Paulo Soares wrote:
>> > 
>> > I think that what you require are different alignments in 
>> the same line.
>> > It's possible to achieve that with a PdfPTable with two 
>> columns without
>> > borders, one left aligned and the other right aligned, both 
>> with no wrap
>> > set. 
>> > 
>> > Paulo
>> > 
>> >> -----Original Message-----
>> >> From: [EMAIL PROTECTED] 
>> >> [mailto:[EMAIL PROTECTED] On 
>> >> Behalf Of dayvidpow
>> >> Sent: Monday, December 03, 2007 6:31 PM
>> >> To: [email protected]
>> >> Subject: [iText-questions] Phrase containing Chunks/Phrase 
>> >> with multiple Run Directions
>> >> 
>> >> 
>> >> Currently, in iText I can create a new Phrase object with a 
>> >> main font and
>> >> then within the Phrase I can have additional Chunks or Phrases with
>> >> different fonts.  Therefore, likewise would it be possible 
>> to create a
>> >> Phrase with a main run direction and then add additional 
>> >> Chunks or Phrases
>> >> to it with different run directions ? 
>> >> 
>> >> I know that iText does not currently support thism, but I am 
>> >> just looking at
>> >> how i can possibly extend the Phrase class to meet a special 
>> >> need, Which is
>> >> to output some text in left-to-right and right-to-left 
>> >> language on the same
>> >> line using ColumnText.go() method, instead of 
>> >> ColumnText.showTextAligned
>> >> (which requires absolute positioning).
>> >> 
>> >> Can the Phrase class be extended in this way ?
> 
> 
> Aviso Legal:
> 
> Esta mensagem é destinada exclusivamente ao destinatário. Pode conter
> informação confidencial ou legalmente protegida. A incorrecta transmissão
> desta mensagem não significa a perca de confidencialidade. Se esta
> mensagem for recebida por engano, por favor envie-a de volta para o
> remetente e apague-a do seu sistema de imediato. É proibido a qualquer
> pessoa que não o destinatário de usar, revelar ou distribuir qualquer
> parte desta mensagem. 
> 
> 
> 
> Disclaimer:
> 
> This message is destined exclusively to the intended receiver. It may
> contain confidential or legally protected information. The incorrect
> transmission of this message does not mean the loss of its
> confidentiality. If this message is received by mistake, please send it
> back to the sender and delete it from your system immediately. It is
> forbidden to any person who is not the intended receiver to use,
> distribute or copy any part of this message.
> 
> 
> 
> 
> -------------------------------------------------------------------------
> SF.Net email is sponsored by: The Future of Linux Business White Paper
> from Novell.  From the desktop to the data center, Linux is going
> mainstream.  Let it simplify your IT future.
> http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
> _______________________________________________
> 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/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Phrase-containing-Chunks-Phrase-with-multiple-Run-Directions-tf4938404.html#a14173512
Sent from the iText - General mailing list archive at Nabble.com.


-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
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