You are here:   » Home » Documentation » Details » How-To » Print » Chapter Print

Chapter Print

Author: F. Hoffmann, 2003/07/24

NOTE: this document is obsolete and describes an approach that was relevant before the introduction of ZMS filters.

In addition to the normal print version of single pages with the common function:
<a href="index_print_eng.html" target="_blank"><dtml-var "getLangStr('ATTR_PRINTVERSION',lang)"></a>
it is possible to generate longer prints. Via a request for 'attr_dc_type'='Chapter' an optional chapter print option is inserted in bodyContent_Copyright-Template. The chapter print creates a content stream by recursive assembling displayed as PDF file. Via a comparable call <a href="index_print.pdf?lang=<dtml-var lang>" target="_blank"><dtml-var "getLangStr('PRINTCHAPTER',lang)"></a> folllowing DTML method is used:

<!-- BO index_print.pdf -->
<dtml-call "REQUEST.set('l',[])">
<dtml-call "l.append('<html>\n')">
<dtml-call "l.append('<body>\n')">
<dtml-call "REQUEST.set('obs',[getSelf()])">
<dtml-call "obs.extend(getTreeNodes(REQUEST))">
<dtml-let level="obs[0].getLevel()">
<dtml-in obs>
 <dtml-if "isPage()">
  <dtml-call "l.append('<h%i>'%(getLevel()-level+1)+ 
   getTitle(REQUEST)+'</h%i>'%(getLevel()-level+1)+'\n')">
 <dtml-elif "isPageElement()">
  <dtml-call "l.append(getBodyContent(REQUEST)+'\n')">
 </dtml-if>
</dtml-in>
</dtml-let>
<dtml-call "l.append('</body>\n')">
<dtml-call "l.append('</html>\n')">
<dtml-call "RESPONSE.setHeader('Content-Type','application/pdf')">
<dtml-return "html2pdf(''.join(l))">
<!-- EO index_print.pdf -->