thanks for your help dear,
but the font is true, because it works with a pure ColumnText and arabic
characters are being shown.
and I added the returned elements in a PdfPTable.
but the problems remains.
in fact my problem is with HTML parsing.
when I have HTML <table> tag and it contains Arabic characters, after
parsing, the table exists in pdf file but the characters doesn't.
I think there is lack of support for this case.(html code snippet with
Arabic content).
I will put my code here,
List<Element> objects =
HTMLWorker.parseToList(new StringReader(""
+ "<p dir=\"ltr\" style=\"text-align: right;\">"
+ " </p>"
+ "<table border=\"1\" cellpadding=\"1\"
cellspacing=\"1\" style=\"width: 500px;\">"
+ " <tbody> <tr> <td>"
+ " سلام</td>"
+ " <td dir=\"ltr\">"
+ " asdadsasdasdasd</td>"
+ " </tr> <tr>"
+ " <td dir=\"ltr\">"
+ " <strong>asdasdasd</strong></td>"
+ " <td dir=\"ltr\">"
+ " <span style=\"color: rgb(255, 0, 0);\">"
+ "<span style=\"background-color: rgb(255, 255,
0);\">dasdasdasdasd</span></span></td>"
+ " </tr> <tr>"
+ " <td> </td>"
+ " <td> </td>"
+ " </tr> </tbody>"
+ "</table>"
+ ""),
null, providers);
PdfPTable tblHtmlPage = new PdfPTable(1);
tblHtmlPage.setTotalWidth((float) (pageSize.getWidth() * 0.8));
tblHtmlPage.setLockedWidth(true);
tblHtmlPage.setRunDirection(PdfWriter.RUN_DIRECTION_RTL);
tblHtmlPage.setHorizontalAlignment(Element.ALIGN_LEFT);
for (Element element : objects) {
PdfPTable tbl = (PdfPTable) element;
tbl.setRunDirection(PdfWriter.RUN_DIRECTION_RTL);
tbl.setHorizontalAlignment(Element.ALIGN_LEFT);
tblHtmlPage.addCell(tbl);
}
tblHtmlPage.writeSelectedRows(0, -1,
(float) (pageSize.getWidth() - (pageSize.getWidth() *
0.1) - tblHtmlPage.getTotalWidth()),
(float) (pageSize.getTop() - ((pageSize.getHeight() *
0.20))),
contentByte);
Thanks for your attention and help.
On Mon, Jan 10, 2011 at 3:30 PM, 1T3XT BVBA <[email protected]> wrote:
> Op 10/01/2011 12:17, pedram farzaneh schreef:
> > 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
> > is missed.
> >
> > I will appreciate any help.
> You're experiencing two problems:
> 1. You're using the wrong font, create a FontProvider as documented in
> chapter 9.
> 2. HTMLWorker currently doesn't support the R2L writing system and
> Arabic Ligaturization. You'll have to work around this, for instance by
> adding the objects returned by HTMLWorker to a PdfPTable or a ColumnText
> object for which the R2L parameter is set.
>
>
> ------------------------------------------------------------------------------
> Gaining the trust of online customers is vital for the success of any
> company
> that requires sensitive data to be transmitted over the Web. Learn how to
> best implement a security strategy that keeps consumers' information secure
> and instills the confidence they need to proceed with transactions.
> http://p.sf.net/sfu/oracle-sfdevnl
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> 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
>
------------------------------------------------------------------------------
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web. Learn how to
best implement a security strategy that keeps consumers' information secure
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
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