Sign In  Sign Up Live-Chat

Unicode in aspose

Last post 03-31-2008, 9:33 PM by Hans.firefox. 11 replies.
Sort Posts: Previous Next
  •  01-29-2008, 1:21 AM 110847

    Unicode in aspose

    Hello,

    I'm trying to add some information with Arabic (Unicode) in PDF, but unfortunately it didn't work even with using utf-8 in XML file .I used a specific template for Arabic numbers and it works fine while the font that suppose to work with Arabic words is not working fine, so please have a look to the code below and help me.

    XML code is

    <?xml version="1.0" encoding="utf-8" ?>

    the most important things here are :

    Table ColumnWidths="120 120 60 40 200" DefaultCellPaddingBottom="0" DefaultCellPaddingLeft="35" DefaultCellPaddingRight="0" DefaultCellPaddingTop="0">

    - <Border>

      <All LineWidth="0" />

      </Border>

    - <DefaultCellBorder>

      <All LineWidth="0" />

      </DefaultCellBorder>

    - <Row>

      <Cell />

      <Cell />

      <Cell />

      <Cell />

    - <Cell PaddingLeft="0">

    - <Text ID="TextCustomerName" FontName="Times New Roman"  FontSize="10" Alignment="Right">

      <Segment ID="SegmentCustomerName" Alignment="Right" FontName="Times New Roman" FontSize="10" IsUnicode="true" IsRightToLeft="True">CustomerName</Segment>

      <Segment ID="SegmentCustomerAddress">C/O Banque Saudi Fransi</Segment>

      </Text>

      </Cell>

      </Row>

      </Table>

    The above is XML schema and I wrote the value of  string from the code as below :

    C# code 

    Segment customerName = pdf.GetObjectByID("SegmentCustomerName") as Segment;

    customerName.Content = customerName.Content.Replace(customerName.Content.ToString(), ("عملية تسديد بطاقة فيزا "));

    The problem here is the result supposes to be Arabic sentence, while it is appearing as separate characters.

     

    I'II appreciate any help in this regard...

     

    Thanks ,

    Abdullah Al.Fifi

    KSA- BSF Developer

     

     
  •  01-29-2008, 8:39 AM 110915 in reply to 110847

    Re: Unicode in aspose

    Hi,

    Can you please attach your xml file and the source code instead on copy paste, I am having trouble using the xml you provided in this fashion.

    Thanks.

     
  •  01-30-2008, 12:03 AM 111034 in reply to 110915

    Re: Unicode in aspose

    Attachment: Present (inaccessible)

    Hi ,

    Attached here the XML file and source code  .

    XML code is :

     

      <?xml version="1.0" encoding="utf-8" ?>
    - <Pdf Title="Electronic Statement" Author="Banque Saudi Fransi" DestinationType="FitWidth" Creator="Banque Saudi Fransi" IsAnnotationsModifyingAllowed="false" IsContentsModifyingAllowed="false" IsCopyingAllowed="false" IsDocumentAssemblyingAllowed="false" IsFormFillingAllowed="false" IsDegradedPrintingAllowed="false" IsPrintingAllowed="true" IsScreenReadersAllowed="false" Producer="Banque Saudi Fransi" Subject="Electronic Statement" xmlns="Aspose.Pdf">
    - <Section PageMarginLeft="10" PageMarginRight="80" PageMarginTop="140" ID="section1" LineWidth="0.2" PageWidth="20cm">
    - <Header IsFirstPageOnly="false">
    - <Table ColumnWidths="120 120 120 50 120" DefaultCellPaddingBottom="0" DefaultCellPaddingLeft="35" DefaultCellPaddingRight="0" DefaultCellPaddingTop="0">
    - <Border>
      <All LineWidth="0" />
      </Border>
    - <DefaultCellBorder>
      <All LineWidth="0" />
      </DefaultCellBorder>
    - <Row>
      <Cell />
      <Cell />
      <Cell />
      <Cell />
    - <Cell>
      <Image ID="logo" ImageScale="0.60" File="D:\Data\Visual Studio 2005 Projects\EStatementBatch\EStatementBatch\Templates\bsf.jpg" />
      </Cell>
      </Row>
      </Table>
    - <Table ColumnWidths="120 120 60 40 200" DefaultCellPaddingBottom="0" DefaultCellPaddingLeft="35" DefaultCellPaddingRight="0" DefaultCellPaddingTop="0">
    - <Border>
      <All LineWidth="0" />
      </Border>
    - <DefaultCellBorder>
      <All LineWidth="0" />
      </DefaultCellBorder>
    - <Row>
      <Cell />
      <Cell />
      <Cell />
      <Cell />
    - <Cell PaddingLeft="0">
    - <Text ID="TextCustomerName" FontName="Times New Roman" FontSize="10" Alignment="Right">
      <Segment ID="SegmentCustomerName" Alignment="Right" FontName="Times New Roman" FontSize="10" IsUnicode="true" IsRightToLeft="True">CustomerName</Segment>
      <Segment ID="SegmentCustomerAddress">C/O Banque Saudi Fransi</Segment>
      </Text>
      </Cell>
      </Row>
      </Table>
    - <Table ColumnWidths="550" DefaultCellPaddingBottom="0" Alignment="Left" BackgroundColor="rgb 223 255 255" DefaultCellPaddingLeft="35" DefaultCellPaddingRight="0" DefaultCellPaddingTop="0">
    - <Border>
      <All LineWidth="0" />
      </Border>
    - <DefaultCellBorder>
      <All LineWidth="0" />
      </DefaultCellBorder>
    - <Row>
    - <Cell PaddingLeft="0">
    - <Text ID="TextFromTo" FontName="CourierBold" FontSize="10">
      <Segment ID="SegmentFromTo">Page $p</Segment>
      </Text>
      </Cell>
      </Row>
      </Table>
    - <Table ColumnWidths="530" DefaultCellPaddingBottom="0" Alignment="Left" DefaultCellPaddingLeft="35" DefaultCellPaddingRight="0" DefaultCellPaddingTop="0">
    - <Border>
      <All LineWidth="0" />
      </Border>
    - <DefaultCellBorder>
      <All LineWidth="0" />
      </DefaultCellBorder>
    - <Row>
    - <Cell PaddingLeft="0">
    - <Text ID="TextAccountNumber" FontName="CourierBold" FontSize="8" IsTrueTypeFontBold="true">
      <Segment ID="SegmentAccountNumber">Account Number</Segment>
      </Text>
      </Cell>
      </Row>
      </Table>
    - <Table ID="TransHeader" ColumnWidths="80 75 75 200 70 70" DefaultCellPaddingBottom="0" Alignment="Left" BackgroundColor="rgb 223 255 255" DefaultCellPaddingLeft="35" DefaultCellPaddingRight="0" DefaultCellPaddingTop="0">
    - <Border>
      <All LineWidth="0.2" />
      </Border>
    - <DefaultCellBorder>
      <All LineWidth="0.2" />
      </DefaultCellBorder>
    - <Row>
    - <Cell PaddingLeft="0">
    - <Text ID="TextTrandDate">
      <Segment ID="SegmentTrandDate" />
      </Text>
      </Cell>
    - <Cell PaddingLeft="0">
    - <Text ID="TextValueDate" Alignment="Right" FontName="Courier" FontSize="10" IsRightToLeft="true" IsUnicode="true">
      <Segment ID="SegmentValueDate">مدين</Segment>
      </Text>
      </Cell>
    - <Cell PaddingLeft="0">
    - <Text ID="TextTranDescription" Alignment="Right" FontName="Courier" FontSize="10" IsRightToLeft="true" IsUnicode="true">
      <Segment ID="SegmentTranDescription">دائن</Segment>
      </Text>
      </Cell>
    - <Cell PaddingLeft="0">
    - <Text ID="TextDebit" Alignment="Right" FontName="c:\windows\fonts\bsfAlkatib2.ttf" FontSize="10" IsUnicode="True" IsRightToLeft="true">
      <Segment ID="SegmentDebit">العملية</Segment>
      </Text>
      </Cell>
    - <Cell PaddingLeft="0">
    - <Text ID="TextFromCredit" Alignment="Right" TruetypeFontFileName="c:\windows\fonts\bsfAlkatib2.ttf" FontSize="10" IsRightToLeft="True" IsUnicode="false">
      <Segment ID="SegmentCredit">kazem</Segment>
      </Text>
      </Cell>
    - <Cell PaddingLeft="0">
    - <Text ID="TextRuningBal" Alignment="Right" FontName="Courier" FontSize="10" IsRightToLeft="true" IsUnicode="true">
      <Segment ID="SegmentRuningBal">الوقت</Segment>
      </Text>
      </Cell>
      </Row>
      </Table>
      </Header>
    - <Table ID="TransDetail" IsBroken="false" ColumnWidths="70 70 70 200 70 70" DefaultCellPaddingBottom="0" DefaultCellPaddingLeft="35" DefaultCellPaddingRight="0" DefaultCellPaddingTop="0">
    - <Border>
      <All LineWidth="0" />
      </Border>
    - <DefaultCellBorder>
      <All LineWidth="0" />
      </DefaultCellBorder>
    - <Row>
    - <Cell PaddingLeft="0">
    - <Text ID="TextTrandDateDetail" Alignment="Right">
      <Segment ID="SegmentTranDateDetail" />
      </Text>
      </Cell>
    - <Cell PaddingLeft="0">
    - <Text ID="TextValueDateDetail">
      <Segment ID="SegmentValueDateDetail" />
      </Text>
      </Cell>
    - <Cell PaddingLeft="0">
    - <Text ID="TextTranDescriptionDetail">
      <Segment ID="SegmentTranDescriptionDetail" />
      </Text>
      </Cell>
    - <Cell PaddingLeft="0">
    - <Text ID="TextDebitDetail">
      <Segment ID="SegmentDebitDetail" />
      </Text>
      </Cell>
    - <Cell PaddingLeft="0">
    - <Text ID="TextFromCreditDetail">
      <Segment ID="SegmentCreditDetail" />
      </Text>
      </Cell>
    - <Cell PaddingLeft="0">
    - <Text ID="TextRuningBalDetail">
      <Segment ID="SegmentRuningBalDetail" />
      </Text>
      </Cell>
      </Row>
      </Table>
    - <Footer>
    - <Table ColumnWidths="550" DefaultCellPaddingBottom="0" Alignment="Left" DefaultCellPaddingLeft="35" DefaultCellPaddingRight="0" DefaultCellPaddingTop="0">
    - <Border>
      <All LineWidth="0" />
      </Border>
    - <DefaultCellBorder>
      <All LineWidth="0" />
      </DefaultCellBorder>
    - <Row>
    - <Cell PaddingLeft="0">
    - <Text ID="TextRuningBal" FontName="Courier" FontSize="6">
      <Segment ID="SegmentFooterDescriptor">IF THE ABOVE BALANCE IS NOT IN ACCORDANCE WITH YOUR RECORD, PLEASE ADVISE OUR AUDITORS REGARDING THESE DIFFERENCES, MESSRS:ERNST & YOUNG P.O BOX 2732 RIYADH 11461 OR KPMG AL FOZAN & BANNAGA P.O BOX 92876 RIYADH 11663.(SAUDI -ARABIA)</Segment>
      </Text>
      </Cell>
      </Row>
      </Table>
    - <Table ColumnWidths="50 500" DefaultCellPaddingBottom="0" Alignment="Left"