Close out for anyone Google-ing this in the future.

When you request a font from iText, if it cannot find that font it returns a 
different font. And that different font generally does not include Arabic & 
Hebrew glyphs.


From: Mark Storer [mailto:[email protected]]
Sent: Wednesday, March 23, 2011 12:10 PM
To: Post all your questions about iText here
Subject: Re: [iText-questions] How to display Arabic

What version of iText are you using?

What OS are you using (I'm gonna guess some version of windows from your file 
path).

Examine the return value of getFont() in a debugger.  What font is being 
returned?  I suspect it's not what you're asking for.

--Mark Storer
  Senior Software Engineer
  Cardiff.com

import legalese.Disclaimer;
Disclaimer<Cardiff> DisCard = null;



________________________________
From: David Thielen [mailto:[email protected]]
Sent: Wednesday, March 23, 2011 10:33 AM
To: [email protected]
Subject: [iText-questions] How to display Arabic
I would swear this has worked in the past – but I can’t get it to display 
Arabic or Hebrew. I’ve gone back to the sample in the book – and it doesn’t 
work.

Any ideas?

Thanks – dave

                public static void main(String[] args) throws Exception {

                                FontFactory.registerDirectories();

                                Rectangle pagesize = new Rectangle(8.5f * 72, 
11 * 72);
                                Document document = new Document (pagesize, 72, 
72, 72, 72);
                                PdfWriter writer = 
PdfWriter.getInstance(document, new FileOutputStream("c:\\test\\report.pdf"));
                                document.open();

//                            Font font = FontFactory.getFont("Simplified 
Arabic", BaseFont.IDENTITY_H, true, 22, Font.BOLD);
                                Font font = FontFactory.getFont("arialuni", 
BaseFont.IDENTITY_H, true, 22, Font.BOLD);

                                ColumnText column = new 
ColumnText(writer.getDirectContent());
                                column.setSimpleColumn(36, 770, 569, 36);
                                
column.setRunDirection(PdfWriter.RUN_DIRECTION_RTL);
                                column.addElement(new Paragraph("Arabic", 
font));
                                column.addElement(new Paragraph("اليوم يوم خميث 
", font));
                                column.addElement(new Paragraph("Hebrew", 
font));
                                column.addElement(new Paragraph("אחת שתיים ", 
font));
                                column.go();

                                document.close();
                }

------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to