I recently built an application that required precise control over print
output, so I feel your pain. It's like one has to trick CFDocument into
using stylesheets.

I looked at my styles and the only difference that might be signifcant is
that I explicitly set margin and padding to zero for my 'container' style.

margin: 0 0 0 0;
padding: 0 0 0 0;

The other difference that I noticed is in how your code includes styles.
Here is a snippet from the HTML header that I am using.


<?xml version="1.0" encoding="iso-8859-1"?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> 
<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en"> 

<head>
        <title><cfoutput>#variables.webpage_title#</cfoutput></title>
        <!--- Use PDF specific stylesheet --->
        <!--- did this weird stuff because of the bass-ackwards way that
cfdocument handles style sheets --->
        <style type="text/css" media="screen">
                <cfinclude template="../../css/workorderpdf.css">
        </style>
        
</head>



-----Original Message-----
From: cftalk [mailto:[email protected]] 
Sent: Thursday, August 06, 2009 9:01 PM
To: cf-talk
Subject: CFDOCUMENT, when 8.5 inches is not 8.5 inches



Hey Guys,

 

Everyone knows cfdocument and css don’t play very nice (and its a shame). So
I thought I would start with a clean  HTML page and some simple CSS using
‘in’ for all measurements. So I started off with a simple page that has a
single div that is supposed to be 8.5 inches x  11 inches. I set the size of
the div using CSS. When it renders in the PDF it does not stretch all the
way across and makes it maybe ¾ of the way across. How is that possible? My
code is below:

 

 

<cfsavecontent variable="page">

<cfoutput>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>

<html xmlns="http://www.w3.org/1999/xhtml";>

    <head>

        <title></title>

        <style type="text/css">

            body

            {

                  margin:0in;

                  padding:0in;

            }

                  

                  

            .mypage

            {

                  background: white;

                  border:1px solid ##dbdbdb;

                  height: 11in;

                  width: 8.5in;

                  position:absolute;

                  overflow:hidden

            }

                  

            .header

            {

                  font-family:arial;

                  color:white;

                  font-size:.18in;

                  

            }

        </style>

    </head>

    <body>

 

      <div id="page1" class="mypage" style="border:1px solid black">    

            <div style="background:green;width:100%;padding:.2in">

                  <span class="header">

                  This is a test Page

                  </span>

            </div>            

      </div>

   </body>

</html>

</cfoutput>

</cfsavecontent>

 

<cfoutput>

      <cfdocument 

            fontembed         = "yes"

            marginbottom      = "0"

            marginleft        = "0"

            marginright       = "0"

            margintop         = "0"

            pagetype          = "custom"

            pagewidth         = "8.5"

            pageheight        = "11"

            unit              = "in"

            format            = "pdf">

 

            <cfdocumentsection>

               #page#

            </cfdocumentsection>

      </cfdocument>

</cfoutput>

 

 

 

 




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325264
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to