Skip to main content
Inspiring
Oct 19, 2007 5:44 PM UTC
Question

CFDOCUMENT, PDF, and CSS

Hi folks -

I was wondering has anybody been successful in implementing CFDOCUMENT with PDF and a web page using CSS 1 or CSS 2?

When I display my web page in my browser (IE 6), it renders completely perfect. When I pushed it through CFDOCUMENT, it gets messed up when it is rendered.

I am open to ideas, suggestions, and other creative solutions.

I have already tried CFHTTP, and it won't work because of the tight environment we have in the office.

I can post my code if requested.

Thanks,

Doug
This topic is closed to new replies. Start a new post to keep the conversation going.

9 replies

BKBK
Community Expert
Community Expert
Sep 4, 2021 11:34 AM UTC

The original question is no longer relevant. It was asked 14 years ago, when CFDocument was still in its infancy.  CFDocument has developed substantially since.

Translate
Participant
Aug 31, 2021 8:31 AM UTC

you don´t need !important in style.cfm

Translate
Participant
Aug 31, 2021 8:17 AM UTC

This works for me:

<cfoutput>
<cfdocument
format="PDF"
pagetype="A4"
orientation="portrait"
fontEmbed="true"
unit="cm"
localUrl="true">

<html>
<head>
<title>Test mit cfdocument</title>
<cfinclude template="./css/style.cfm"/>
</head>
<body>
<img src="#localUrl("images/pay.png")#" />
<img src="#localUrl("images/prowin.png")#" />
<p id="backky" class="test">Say something</p>
</body>
</html>
</cfdocument>

<cffunction name="localUrl" >
<cfargument name="file" />
<cfreturn "file:///#ExpandPath(file)#">
</cffunction>

</cfoutput>

style.cfm

<style>
.test {
color: red !important;
background-color: black !important;
}
#backky {
color: red !important;
background-color: black !important;
}
</style>

 

 

 

 

 

 

 

Translate
Tim Cunningham
Participating Frequently
Jan 9, 2013 8:39 PM UTC

I wrote a chapter in LearnCFInAWeek.com that may be of great help to you: http://learncfinaweek.com/week1/cfdocument/

Translate
Oct 26, 2007 1:37 PM UTC
I have found the following page helpful:
http://rip747.wordpress.com/2007/09/10/cfdocument-it-works-if-you-know-how/
Translate
Participant
Jan 9, 2013 6:58 PM UTC

use only

<style type="text/css">

  @import url("../../../comun/file_name.css");

</style>

Translate
Oct 20, 2007 12:07 PM UTC
I have gotten it to work with CSS but for some reason, I need to link the .css file to the page through the import function.
Translate
Inspiring
Oct 20, 2007 4:52 AM UTC
Fordian-Slip,

I have not had any luck myself working with separate css and cfdocument.

However, I have had success using css inline and getting the desired
results.

<p style="font-family:arial; font-size:12px; color: #FFFFFF; etc.>

Hope this helps you out, if not perhaps I don't understand what it is
you are trying to do and seeing your code might provide a clearer
picture.

Leonard B
Translate
Oct 19, 2007 10:50 PM UTC
There are hotfixes available for CFDOCUMENT so if you haven't loaded those yet I wouid do that first.
Translate