Hello everyone :) ,
this is my first post in here ,
well , i want to display a right to left langage like urdu,arabic ..
my code is working fine , but doesn't display this kind of langage :rolleyes: ,

<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="itextsharp.text" %>
<%@ Import Namespace="itextsharp.text.pdf" %>
<%@ Import Namespace="itextsharp" %>
 


<script runat="server">
    



    Protected Sub btnGeneratePDF_Click(ByVal sender As Object, ByVal e As EventArgs)
        
 
        
        'Create Document class object and set its size to letter and give space left, right, Top, Bottom Margin
          
        Dim doc As New Document(iTextSharp.text.PageSize.LETTER, 10, 10, 42, 35)
 
        Try

            Dim wri As PdfWriter = PdfWriter.GetInstance(doc, New FileStream("C:\Documents and Settings\Rahma\Bureau\Test.pdf", FileMode.Create))
       
            'Open Document to write

            doc.Open()



            'Write some content
          
            Dim paragraph As New Paragraph("hello")
         
            Dim underContent As iTextSharp.text.pdf.PdfContentByte = Nothing
            
            Dim pharse As New Phrase("This is my second line using Pharse.")
             
            Dim chunk As New Chunk(" This is my third line using Chunk.")

            ' Now add the above created text using different class object to our pdf document

            doc.Add(paragraph)
           [B] ColumnText.ShowTextAligned(underContent, Element.ALIGN_CENTER,pharse, 100, 100, 50, PdfWriter.RUN_DIRECTION_LTR, ColumnText.AR_LIG)[/B]
            doc.Add(pharse)
            doc.Add(chunk)
             
         
        Catch dex As DocumentException

            'Handle document exception

        Catch ioex As IOException

            'Handle IO exception

        Catch ex As Exception

            'Handle Other Exception

        Finally

            'Close document

            doc.Close()

        End Try

    End Sub
</script>

<html>
<body>
<form id="Form1" runat="server">

<asp:Button id="button2" Text="Click me" runat="server" OnClick="btnGeneratePDF_Click" />
</form>
</body>
</html>

some told me that

[B] ColumnText.ShowTextAligned(underContent, Element.ALIGN_CENTER,pharse, 100, 100, 50, PdfWriter.RUN_DIRECTION_LTR, ColumnText.AR_LIG)[/B]

could display arabic , but i didn't know how to use it , so if any one could help me with that please ...

hello again :
this code worked for me :

Dim chaine = "أهلا و سهلا"
  Dim tableau As New PdfPTable(1)
  tableau.RunDirection = PdfWriter.RUN_DIRECTION_RTL
  tableau.AddCell(New Phrase(10, chaine, f2))
  myDocument.Add(tableau)

good luck for everybody ...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.