Hi ,
I have a HTML code snippet which contains <table> in which the columns
contain Arabic text.
after rendering the html snippet by "HTMLWorker" class the resulting
element
is instance of a PdfPTable which is shown in the pdf file but the text
direction is from left to right.
i have tried with Stylesheet class, PdfTable.setRunDirection(), but the
text is always from left to right.
Are they any solution to this problem?
thank you
here is a part of my code:
Document document = new Document();
writer = PdfWriter.getInstance(document,os);
document.open();
FontFactory.register(
"C:\\windows\\Fonts\\ARIALBD.TTF");
//FontFactory.register("C:\\ARIALUNI.TTF");
StyleSheet st = new StyleSheet();
st.loadTagStyle("font", "face", "Arial Bold");
st.loadTagStyle("body", "encoding", "Identity-H");
//st.loadTagStyle("font", "size", "12");
st.loadTagStyle("div", "align", "Left");
st.loadTagStyle("div", "dir", "rtl");
st.loadTagStyle("table", "dir", "rtl");
HTMLWorker worker = new HTMLWorker(document);
//System.out.println(content);
StringReader stringReader = new
StringReader(content); //content is the string containing html code
ArrayList pl = HTMLWorker.parseToList
(stringReader, st);
for (int k = 0; k < pl.size(); ++k)
{
PdfPTable tbl = (PdfPTable)
((Element)pl.get(k));
tbl.setRunDirection(PdfWriter.
RUN_DIRECTION_RTL);
document.add(tbl);
System.out
.println(((Element)pl.get(k)).toString());}
document.close();
Best Regards,
Fitouri Abdelaziz
This message and any attachments (the "message") is intended for the sole use
of its addressee.
If you are not the addressee, please immediately notify the sender and then
destroy the message. As this message and/or any attachments may have been
altered without our knowledge, its content is not legally binding on PicoSoft.
All rights reserved. www.picosoft.biz ------------------------------------------------------------------------------
RSA® Conference 2012
Save $700 by Nov 18
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
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