James,
This doesn't answer your question about margins...and it is not that
cusromizable, but here is some code that I did that prints from Windows
XP, 1024x768.  It is made to print out the most common 3x10 labels (3
columns, 10 rows on a page).  Hope this will help some.

<html>
<head>
<title>Address Labels</title>
<SCRIPT LANGUAGE="_javascript_">
function printPage() {
  if (window.print)
   window.print()
  else
   alert("Sorry, your browser doesn't support this feature.");
  }
  </SCRIPT>
</head>


<body>
<!--- gets query from the database --->
<cfquery name="myQuery" datasource="DSN">
    SELECT name, address, state, zip
    FROM TABLENAME
</cfquery>

<!-----  display query results ---------------------------->
<span style="position:absolute; left: 780;"
_javascript_:printPage();">
    <input type=submit value="Print!">
</span>


<cfset cnt = 0>
<cfset rowcnt = 1>
<cfset offset = 0>
<cfset labelSpacing = 50>
<cfset divWidth = 215>
<cfset width = divWidth + labelSpacing>


<cfoutput>
<cfloop query="getCustomers">
    <cfset cnt = cnt + 1>
    <cfset col = cnt MOD 3>


    <cfif col eq 1>
        <cfset top = (cnt\3) * 95.5 + offset>
        <cfset left = 0>
        <cfelseif col eq 2>
        <cfset top = (cnt\3) * 95.5 + offset>
        <cfset left = width>
    <cfelseif col eq 0>
        <cfset top = ((cnt-1)\3) * 95.5 + offset>
        <cfset left = 2 * width>
        <cfset col = 3>
    </cfif>
    <div  id=customer#cnt#
           style="position: absolute; margin: 0; padding: 0; spacing: 0;
width: #divWidth# ; top: #top#; left: #left#; font-size: x-small;
text-align: top; color: black; text-decoration: 'none';"
           > this.style.textDecoration='underline';"
           > this.style.textDecoration='none';";>#name#<BR>#address#<BR>#city#,&nbsp;
#st#&nbsp;&nbsp;#zip#</div>
    <cfif cnt MOD 3 eq 0>
        <cfset rowcnt = rowcnt + 1>
        <cfif rowcnt MOD 10 eq 1>
            <cfset offset = offset - 43>
        </cfif>
    </cfif>
</cfloop>
</cfoutput>
</body>
</html>

hth - Frank

-----------------------------------------------------------
The Preceeding Email Has Been Scanned
and Verified By QBOS Security Systems
-----------------------------------------------------------
QBOS, Inc.
14275 Midway Rd.  Suite 220
Addison, TX 75001
972.233.5066
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to