Java tutorial
import java.io.FileOutputStream; import com.lowagie.text.Chunk; import com.lowagie.text.Document; import com.lowagie.text.Element; import com.lowagie.text.PageSize; import com.lowagie.text.pdf.ColumnText; import com.lowagie.text.pdf.PdfContentByte; import com.lowagie.text.pdf.PdfWriter; public class RightToLeftPDF { public static void main(String[] args) { try { Document document = new Document(PageSize.A4, 50, 50, 50, 50); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("RightToLeftPDF.pdf")); document.open(); PdfContentByte cb = writer.getDirectContent(); ColumnText ct = new ColumnText(cb); ct.setSimpleColumn(100, 100, 500, 800, 24, Element.ALIGN_LEFT); ct.setSpaceCharRatio(PdfWriter.NO_SPACE_CHAR_RATIO); ct.setLeading(0, 1); ct.setRunDirection(PdfWriter.RUN_DIRECTION_RTL); ct.setAlignment(Element.ALIGN_CENTER); ct.addText(new Chunk("ABCD")); ct.go(); ct.setAlignment(Element.ALIGN_JUSTIFIED); ct.addText(new Chunk("ABCD")); ct.go(); ct.setAlignment(Element.ALIGN_CENTER); ct.addText(new Chunk("ABCD")); ct.go(); document.close(); } catch (Exception e) { e.printStackTrace(); } } }