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[request.subsite.id].url & request.page.filename>

<cfif StructKeyExists(URL,"RenderForPrint")>

  <cfoutput>

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

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

  </cfoutput>

<cfelse>

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

  <cfoutput>

  <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>' );

  </script>

  </cfoutput>

</cfif>

 

Related Links


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


For technical support:

http://www.paperthin.com/support/