The problem is still there with iText 5.5.3. Is there any chance of review?
2013-12-06 19:52 GMT+03:30 Hossein Noorikhah <hossein...@gmail.com>:
>
> Hi,
>
> I've been using iText for some years and I appreciate the quality of its
> support for various languages and scripts. Here I want to discuss a problem
> in justifying right-to-left languages (as I'm not aware of Bugzila or
> similar bug reporting website for AGPL version).
>
> Considering right-to-left example presented here:
>
> iText in Action: Chapter 11: Choosing the right font
> Part3 - Chapter11 - *RightToLeftExample*
> http://itextpdf.com/examples/iia.php?id=204
>
> the actual text that is used for the paragraph is too short, and can not
> show possible problems that may arise. If you do right or left align a
> multi-line paragraph, the output is as desired, but when you full justify
> it, no matter what your column run direction is, the last line falls to
> left, as it is accepted for LTR, but is wrong for RTL paragraph.
> [image: تصویر درون برنامهای 1]
> The attached sample is based on the example 3-11 mentioned above, and
> tested using iText 5.4.5.
>
> As a suggestion, I think having big samples for testing various languages
> in different situations can help finding possible problems.
>
> Thanks,
> Hossein
>
/*
* This class is part of the book "iText in Action - 2nd Edition"
* written by Bruno Lowagie (ISBN: 9781935182610)
* For more info, go to: http://itextpdf.com/examples/
* This example only works with the AGPL version of iText.
*/
import java.io.FileOutputStream;
import java.io.IOException;
import com.itextpdf.text.Element;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Font;
import com.itextpdf.text.PageSize;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.pdf.BaseFont;
import com.itextpdf.text.pdf.ColumnText;
import com.itextpdf.text.pdf.PdfWriter;
public class RightToLeftExample {
/** The resulting PDF file. */
public static final String RESULT
= "right_to_left.pdf";
/**
* Creates a PDF document.
* @param filename the path to the new PDF document
* @throws DocumentException
* @throws IOException
* @throws DocumentException
* @throws IOException
*/
public void createPdf(String filename) throws IOException, DocumentException {
// step 1
Document document = new Document(PageSize.A4);
// step 2
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(filename));
// step 3
document.open();
// step 4
BaseFont bf = BaseFont.createFont(
"arial.ttf", BaseFont.IDENTITY_H, true);
Font font = new Font(bf, 14);
ColumnText column = new ColumnText(writer.getDirectContent());
column.setSimpleColumn(36, 770, 569, 36);
column.setRunDirection(PdfWriter.RUN_DIRECTION_RTL);
Paragraph p = new Paragraph("آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آز fjjd j jsjsj مايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش آزمايش.", font);
p.setAlignment(Element.ALIGN_JUSTIFIED);
column.addElement(p);
column.go();
// step 5
document.close();
}
/**
* Main method.
*
* @param args no arguments needed
* @throws DocumentException
* @throws IOException
*/
public static void main(String[] args) throws IOException, DocumentException {
new RightToLeftExample().createPdf(RESULT);
}
}
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
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