You are here: Administrators Reference > Site Administration > Static Content Generation > Best Practices > Handling Printer-Friendly Pages


Handling Printer-Friendly Pages

Generating printer-friendly pages does not prohibit statically generating them.  To accomplish this, point the user to the dynamic server when rendering the printer-friendly version of the page, as shown in the code below. In this example, a custom ColdFusion module renders out the printer-friendly link. To render the appropriate dynamic URL (production vs. testing) use the JavaScript variable ‘document.CS_DynamicURL’ as shown below:

<cfset theURL = request.subsitecache[].url &>

<cfif StructKeyExists(URL,"RenderForPrint")>


  <a href="#theURL#"><img src="/format-html.gif" border="0"></a>&nbsp;

  <a href="#theURL#">Web Version</a>



  <cfset tempURL = Right( theURL, Len(theURL)-1 )>


  <script language="JavaScript" type="text/javascript">

    document.write( '<a href="' + document.CS_DynamicURL +

    '#tempURL#?RenderForPrint=1"><img src="/images/printer.gif"

    border="0"></a>&nbsp;<a href="' + document.CS_DynamicURL +

    '#tempURL#?RenderForPrint=1">Print Version</a>' );





Related Links

You can download PDF versions of the Content Contributor's, Administrator's, and Elements Reference documents from the support section of (requires login).

For technical support: