0 Replies Latest reply on Jan 29, 2014 10:04 AM by davecordes

    Accessing CFDocumentItem Variables

    davecordes Level 1

      Hi all,


      I am at a loss how to access a variable that's set inside of a cfdocumentitem tag. The reason I'm doing this is that a client of mine is wanting to print invoices in their browser but they are using double sided paper so I need to access the current page number and if it's not an odd numbered page, I need to force another page break.


      So my code looks somerthing like this:


      <cfdocument format="pdf">


      <cfloop query="getOrders">


      Invoice stuff here...


      <cfdocumentitem type="pagebreak"></cfdocumentitem><!--- Add one page break by default after every order --->


      <cfdocumentitem type="footer" evalatprint="true">

           <cfif CFDocument.CurrentPageNumber MOD 2 EQ 0>

                <cfset AddPageBreak = 0><!--- This is the back side of a page so we don't need to add another page break --->


                <cfset AddPageBreak = 1><!--- This is the front side of the page so we do need to add another page break --->




      <cfif AddPageBreak>

           <cfdocumentitem type="pagebreak"></cfdocumentitem><!--- Add an additional page break for orders that do not end on an even page --->







      Of course this doesn't work because I've learned that cfdocument is implemented as a custom tag. The error I'm getting is "Variable ADDPAGEBREAK is undefined".


      Does anyone have any ideas how to accomplish this?