Wednesday, August 26, 2009

creating PDF and fonts





ColdFusion - Creating PDFs and CSS


original code.

<cfoutput>

<cfdocument format="PDF" bookmark="yes">

<style>

<!---
td{border-bottom: 1px solid ##cccccc; font-size: 10pt;}

-->
</style>

<cfloop query="GetRemotes">

 <cfdocumentsection name="#remoteLocationsMailingAddressRet.name#">

        <table width="100%" border="0" align="center" cellpadding="1" cellspacing="1">
            <tr valign="bottom">
                <td>#remoteLocationsMailingAddressRet.name#</td>
            </tr>
        </table>
 </cfdocumentsection>

</cfloop>

</cfdocument>

</cfoutput>


I noticed that when I commented out the <cfdocumentsection> tag the
CSS would be there. 


So I moved my <style> inside the <cfdocumentsection> tag and it uses
the CSS. :-)

go figure. 


so I now have 

------------------------------------
<cfoutput>

<cfdocument format="PDF" bookmark="yes">

<cfloop query="GetRemotes">

 <cfdocumentsection name="#remoteLocationsMailingAddressRet.name#">

<style>


<!---
td{border-bottom: 1px solid ##cccccc; font-size: 10pt;}


-->

</style>

 <cfdocumentsection name="#remoteLocationsMailingAddressRet.name#">

        <table width="100%" border="0" align="center" cellpadding="1" cellspacing="1">
            <tr valign="bottom">
                <td>#remoteLocationsMailingAddressRet.name#</td>
            </tr>
        </table>
 </cfdocumentsection>

</cfloop>

</cfdocument>

</cfoutput>



Smashing!