CFDocument - How to make html formatting table etc appear in pdfs?

Hi,
I have some code with nice formatting i.e table with stylesheets applied and data is stored in a variable.

This var is shown to user on the page as the var contains table with nice formatting (is this a good approach i.e. storing it in var?) and If user wants pdf, then he can view the data in pdf format. The problem is the table styles are lost in pdf and it just shows plain text in white background.

1)Is there a way I could have the pdf display the table with all the styles I have applied to it???

2)How can I have the Image shown on every page on the top. Right now with my code, the img is shown on the first page only…

Here is the code :

<cfsavecontent variable="Report_StateRegs">
   <cfoutput query="StateRegs" group="Reg_Name">		
       <table class="tableStRegs" align="center">
       ......
       </table>
   </cfoutput>
</cfsavecontent>


<cfif URL.view eq "Reports_State">
<cfdocument marginbottom="0.75" marginleft="0.75" marginright="0.75"
margintop="0.75" format="pdf" unit="in" backgroundvisible="yes">
  <img src="/images/A_Watermark.gif"  width="120" height="49"
 align="absmiddle"/>

<cfoutput> #Report_StateRegs#</cfoutput>

</cfdocument>

<cfelse>
    <cfoutput>#Report_StateRegs#</cfoutput>
</cfif>  

Any suggestions are welcome.

Thanks in advance

Its amazing how you can get to solution sometimes. Its just 10 mins since My first post and I already have a solution. Here you go :

<cfdocument marginbottom=“0.75” marginleft=“0.75” marginright=“0.75”
margintop=“0.75” format=“pdf” unit=“in” backgroundvisible=“yes”>

<style type=“text/css”>
@import url(/css/custom.css);
@import url(/css/default.css);
</style>

<cfdocumentitem type=“header”>
<img src=“/images/A_Watermark.gif” width=“120” height=“49” align=“right”>
</cfdocumentitem>

<!—Use a footer with current page of totalpages format —>
<cfdocumentItem type= “footer”>
<cfoutput>
<em style=“text-align:center”>#cfdocument.currentpagenumber# of #cfdocument.totalpagecount#
</em>
</cfoutput>
</cfdocumentItem>
<cfoutput> #Report_StateRegs#</cfoutput>
</cfdocument>

<cfelse>
<cfoutput>#Report_StateRegs#</cfoutput>
</cfif>

Now only thing remaining is

  1. center the img in pdf( iam able to align right only and when I say absmiddle or middle, it doesnt work)
    2)align page footer to center. I am trying text-align:center but it didnt work.

I am so happy I have it working …woohoo…

Thanks,