cfdocument and css styles

1,100 views
Skip to first unread message

Taco Fleur

unread,
Nov 5, 2007, 3:51:27 AM11/5/07
to cfau...@googlegroups.com
Hello all,
 
I'm trying to generate a PDF with cfdocument in CF7
It generates the PDF, and has the content, but the css styles do not come across, see code
 
<cfdocument
  name="taxInvoicePDF"
  format="PDF"
  pagetype="A4"
  orientation="portrait"
  permissions="allowprinting"
  encryption="40-bit"
  overwrite="no"
  fontembed="yes">
  <cfdocumentsection>
   <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" " http://www.w3.org/TR/html4/strict.dtd">
   <html>
   <head>
   <title>Tax invoice</title>
   <cfoutput>
   <link rel="stylesheet" href="#application.web.root#/_resource/style/default.css" type="text/css" media="print">
   <link rel="stylesheet" href="#application.web.root#/_resource/style/invoices/print.css" type="text/css" media="print">
   <link rel="stylesheet" href="#application.web.root#/_resource/style/typography/default.css" type="text/css" media="print">
   <link rel="stylesheet" href="#application.web.root#/_resource/style/typography/generic.css" type="text/css" media="print">
   </cfoutput>
    <style>
@media print {
   div#cc{
   display:none;
   }
}
</style>
   </head>
   <body>
   <cfinclude template="#application.root#/_resource/include/inc_tax-invoice.cfm">
   </body>
   </html>
  </cfdocumentsection>
 </cfdocument>
 
Even the inline style doesn't come across, I have no idea why not.
 
Thanks in advance for any help.

--
*** http://www.clickfind.com.au
The new Australian search engine for businesses, products and services
*** Virtual and Dedicated Servers with MS SQL from $250 a month
*** Virtual and Dedicated Servers with registered version of ColdFusion from $350 a month
*** ColdFusion licenses at the lowest price

Seona Bellamy

unread,
Nov 5, 2007, 5:06:29 PM11/5/07
to cfau...@googlegroups.com
On 05/11/2007, Taco Fleur <taco...@gmail.com> wrote:
Hello all,
 
I'm trying to generate a PDF with cfdocument in CF7
It generates the PDF, and has the content, but the css styles do not come across, see code
 
Even the inline style doesn't come across, I have no idea why not.
 

I'm not 100% certain, but I seem to remember finding that cfdocument only likes very simple inline CSS - no linked external documents, no @media or anything fancy like that. Just simple style tags with rules in them. A bit of a pain, but you can at least keep them in a separate file and just cfinclude it.

Cheers,

Seona.

Taco Fleur

unread,
Nov 5, 2007, 10:46:41 PM11/5/07
to cfau...@googlegroups.com
Thanks. Simple inline css seems to do the trick.

Reply all
Reply to author
Forward
0 new messages