Skip to main content
Inspiring
February 6, 2018
Question

While generating PDF in ColdFusion Rowspan is not working properly for RTL direction (ex: Arabic)

  • February 6, 2018
  • 1 reply
  • 1350 views

I have a table structure in HTML where I have to use rowspan and RTL(Right To Left) direction. But while converting this HTML to PDF rowspan is not working as expected. Assuming this is a bug in ColdFusion where an HTML with rowsapn and RTL direction is not working correctly.

Note that this is working fine for LTR (Left To Right) direction (ex: English Characters). But I need to use RTL direction since Arabic characters need to be displayed in PDF.

Sample Code :

<cfdocument format="PDF" filename="C:\test.pdf" overwrite="true">

  <!DOCTYPE html>

<html>

<head>

<style>

  table, th, td {

      border: 1px solid black;

  }

  table#mainTable {direction:rtl;}

</style>

</head>

<body>

<cfoutput>

<table id="mainTable">

  <tr>

    <td>Tariff</td>

    <td>Description</td>

    <td>Quantity</td>

    <td>Unit Price</td>

    <td>Amount</td>

  </tr>

  <tr>

    <td rowspan="7" >Customer Level Charges</td>

    <td>9999123456</td>

    <td>18.16</td>

    <td>6</td>

    <td>108.96</td>

  </tr>

  <tr>

    <td>9999123456</td>

    <td>18.16</td>

    <td>6</td>

    <td>108.96</td>

  </tr>

  <tr>

    <td>9999123456</td>

    <td>18.16</td>

    <td>6</td>

    <td>108.96</td>

  </tr>

  <tr>

    <td>Adjustments</td>

    <td colspan="4">-20</td>

  </tr>

  <tr>

    <td>This Month Amount</td>

    <td colspan="4">1091.92</td>

  </tr>

  <tr>

    <td>Last Month outstanding Amount</td>

    <td colspan="4">0</td>

  </tr>

  <tr>

    <td>Total</td>

    <td colspan="4">1146.51</td>

  </tr>

</table>

</cfoutput>

</body>

</html>

</cfdocument>

Expected Result

It should work as how it is working in Browser, screen shot attached.

This topic has been closed for replies.

1 reply

Priyank Shrivastava.
Community Manager
Community Manager
February 6, 2018

Hi,

You can use the cfhtmltopdf tag to convert this to PDF. I have tried this and it showed the correct result.

<cfhtmltopdf source = "doc.html" destination  = "new.pdf" />

Thanks,

Priyank

Thanks, Priyank Shrivastava
Inspiring
February 7, 2018

Thanks Priyank for your response.

But , is there any way to do this using cfdocument tag only since I need to provide a source url in case of cfhtmltopdf. For that I need to modify lot many places in the existing code.

Thanks,

Charlie Arehart
Community Expert
Community Expert
February 7, 2018

Abdul, you do not have to provide a SOURCE (url or file). That's merely an option. You can pass HTML/CFML between the tags, just like CFDOCUMENT.

/Charlie (troubleshooter, carehart. org)