• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Issue in the order of display of Arabic texts in PDF file generated using ColdFusion

Explorer ,
Aug 30, 2017 Aug 30, 2017

Copy link to clipboard

Copied

I have a query result set as given below.

arr.png

I want to display details from this query in a pattern of name1 amount1  unit1,name2 amount2 unit2,name3 amount3 unit3,name4 amount4 unit 4 and that too in RTL (Right To Left) direction since data from the query is Arabic.

For example : please see the screen shot of pdf file.

expected.png

Issue:Order of Arabic text is not correct as expected as given in the above screenshot. Below is the code snippet I used to generate pdf but order of display is wrong.

    <cfset local.qBuckets = QueryNew("amount,name,unit","varchar,varchar,varchar") />

    <cfset Queryaddrow(local.qBuckets,4)>

    <cfset x=1>

    <cfset Querysetcell(local.qBuckets,'amount','غير محدودة',x)>

    <cfset Querysetcell(local.qBuckets,'name','لبيانات المحلية والعالمية',x)>

    <cfset Querysetcell(local.qBuckets,'unit','جيجابايت',x)>

    <cfset y=2>

    <cfset Querysetcell(local.qBuckets,'amount','600',y)>

    <cfset Querysetcell(local.qBuckets,'name','الدولية',y)>

    <cfset Querysetcell(local.qBuckets,'unit','دقيقة',y)>

    <cfset z=3>

    <cfset Querysetcell(local.qBuckets,'amount','300',z)>

    <cfset Querysetcell(local.qBuckets,'name','التجوال الوارد',z)>

    <cfset Querysetcell(local.qBuckets,'unit','دقيقة',z)>

    <cfset p=4>

    <cfset Querysetcell(local.qBuckets,'amount','غير محدودة',p)>

    <cfset Querysetcell(local.qBuckets,'name','المكالمات المحلية / الرسائل القصيرة',p)>

    <cfset Querysetcell(local.qBuckets,'unit','جيجابايت',p)>

    <cfoutput>

    <cfdocument filename="c:\arr-bill.pdf" format="pdf" overwrite="true">

    <table border="0" cellspacing="0" cellpadding="5" align="center" style="width:190mm;direction: rtl;">

    <tr>

    <td style="border-bottom:1pt solid ##000000;">

    <span style="font-size:10pt; font-weight:bold;">Red 750</span>

    <BR />

    <span style="font-size:9pt;">

    <cfset attributes.bucketSep = "">

    <cfloop query="local.qBuckets">

    #attributes.bucketSep# <span style="font-weight: bold;color:black;">#name#</span>

    #amount# #unit#

    <cfset attributes.bucketSep = ",">

    </cfloop>

    </span>

    </td>

    </tr>

    </table>

    </cfdocument>

    </cfoutput>

Notes: Order of Arabic text is correct in HTML output (in browser). Also , the order is correct in pdf file but only when I remove the span used around the name.

PDF generating code where order is correct

    <cfdocument filename="c:\arr-bill.pdf" format="pdf" overwrite="true">

    <table border="0" cellspacing="0" cellpadding="5" align="center" style="width:190mm;direction: rtl;">

    <tr>

    <td style="border-bottom:1pt solid ##000000;">

    <span style="font-size:10pt; font-weight:bold;">Red 750</span>

    <BR />

    <span style="font-size:9pt;">

    <cfset attributes.bucketSep = "">

    <cfloop query="local.qBuckets">

    #attributes.bucketSep# #name#

    #amount# #unit#

    <cfset attributes.bucketSep = ",">

    </cfloop>

    </span>

    </td>

    </tr>

    </table>

    </cfdocument>

Views

972

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 31, 2017 Aug 31, 2017

Copy link to clipboard

Copied

What about going along with the default left-to-right, and doing something as simple as this:

<cfdocument filename="c:\arr-bill.pdf" format="pdf" overwrite="true">

<span style="font-size:10pt; font-weight:bold;">Red 750</span>

<table border="0" cellspacing="0" cellpadding="5" align="center" style="width:190mm">

<cfoutput query="local.qBuckets">

   <tr>

   <span style="font-size:9pt;">

      <td>#unit#</td>

      <td>#amount#</td>

      <td><span style="font-weight: bold;color:black;">#name#</span></td>

   </span>

   </tr>

</cfoutput>

</table>

</cfdocument>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 04, 2017 Sep 04, 2017

Copy link to clipboard

Copied

Thank you for your response. But this will show data in tabular format and my client want it to be shown in comma separated values and that too in Right To Left direction(as I given in the above code under the heading "PDF generating code where order is correct" ) . But here I am facing an issue to highlight the "name" field (used "span" around the name field but thats not working). Would be much helpful if you could help me fix this issue instead of an alternate solution.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 05, 2017 Sep 05, 2017

Copy link to clipboard

Copied

I'm sorry my suggestions are limited. I am unable to read the output, so cannot tell right from left.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 05, 2017 Sep 05, 2017

Copy link to clipboard

Copied

I think , reading does not matter. But the thing is I just want to make it comma separated list with "name" highlighted.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 08, 2017 Sep 08, 2017

Copy link to clipboard

Copied

Hello Abdul, I looked into this some more and may have found the cause of the problem. Cfdocument does not support the "direction" style in CSS.

You can confirm this by temporarily commenting out the cfdocument tag. Then the HTML will display in the direction you expect. We have to look for a workaround.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 08, 2017 Sep 08, 2017

Copy link to clipboard

Copied

LATEST

A possible workaround is to change the order in which ColdFusion outputs the query rows. Start with the last one, and end with the first. The many styles are confusing to me, so I would group them in a style tag.

<cfdocument filename="c:\arr-bill.pdf" format="pdf" overwrite="true">

<html>

<head>

<style type="text/css">

    .tbl

    {

        width:190mm;

        direction:rtl;

    }

    td

    {

        border-bottom:1pt solid #000000;

    }

    .red750

    {

        font-size:10pt;

        font-weight:bold;

    }

    .qryOutput

    {

        font-size:9pt;

    }

    .nm

    {

        font-weight:bold;

        color:black;

    }

</style>

</head>

<body>

<table class="tbl" border="0" cellspacing="0" cellpadding="5" align="center">

    <tr>

        <td>  

        <span class="red750">Red 750</span>

        <BR />

        <cfset attributes.bucketSep = "">

        <span class="qryOutput">

        <cfoutput query="local.qBuckets" >

        <cfset rowNumber = local.qBuckets.recordcount + 1 - local.qBuckets.currentRow>

        #attributes.bucketSep# <span class="nm">#local.qBuckets.name[rowNumber]#</span> #local.qBuckets.amount[rowNumber]# #local.qBuckets.unit[rowNumber]#

        <cfset attributes.bucketSep = ",">

        </cfoutput>

        </span>

        </td>

    </tr>

</table>

</body>

</html>

</cfdocument>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation