Question display right to left langage in pdf with itextsharp

narama87

New member
Joined
Feb 24, 2011
Messages
1
Programming Experience
3-5
Hello everyone :) ,
this is my first post in here ,
well , i want to display an right to left langage like urdu,arabic ..
my code is working fine , but doesn't display this kind of langage :rolleyes: ,
VB.NET:
<%@ 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)
           [COLOR="Red"][B] ColumnText.ShowTextAligned(underContent, Element.ALIGN_CENTER,pharse, 100, 100, 50, PdfWriter.RUN_DIRECTION_LTR, ColumnText.AR_LIG)[/B][/COLOR]
            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 ColumnText.ShowTextAligned could display arabic so i used it like this :
VB.NET:
   [COLOR="Red"][B] ColumnText.ShowTextAligned(underContent, Element.ALIGN_CENTER,pharse, 100, 100, 50, PdfWriter.RUN_DIRECTION_LTR, ColumnText.AR_LIG)[/B][/COLOR]

but i didn't know how to use it :eek:, so if any one could help me with that please ...
 
Back
Top