How to access cfdocument.currentpagenumber outside the cfdocumentitem tag

Reply

Join Date: Aug 2009
Posts: 3
Reputation: Renu Deshpande is an unknown quantity at this point 
Solved Threads: 0
Renu Deshpande Renu Deshpande is offline Offline
Newbie Poster

How to access cfdocument.currentpagenumber outside the cfdocumentitem tag

 
0
  #1
Aug 3rd, 2009
Hi all

Can anybody help me with this.

I want to access cfdocument.currentpagenumber outside the cfdocumentitem tag. I tried the following ways :

1)

  1. <cfdocument format="pdf" orientation="landscape" unit="cm" margintop="4.0" marginbottom="2.0" marginleft="2.2" marginright="2.2"
  2. scale=99 filename="c:\test.pdf" overwrite="yes">
  3.  
  4. <cfoutput>
  5. <cfdocumentsection>
  6. <cfdocumentitem type="header">
  7. <cfset Page = cfdocument.currentpagenumber>
  8. </cfdocumentitem>
  9.  
  10. <cfdocumentitem type="footer" >
  11. FOOTER !!!!
  12. </cfdocumentitem>
  13.  
  14. <table>
  15. <tr>
  16. <td>HELLO</td>
  17. <td> Page No : #Page#</td>
  18. </tr>
  19. </table>
  20.  
  21.  
  22. </cfdocumentsection>
  23. </cfoutput>
  24. </cfdocument>


Output :

Variable PAGE is undefined.

At Line : <td> Page No : #Page#</td>

2)
  1. <cfdocument format="pdf" orientation="landscape" unit="cm" margintop="4.0" marginbottom="2.0" marginleft="2.2" marginright="2.2"
  2. scale=99 filename="c:\test.pdf" overwrite="yes">
  3.  
  4. <cfoutput>
  5. <cfset Page = "">
  6. <cfdocumentsection>
  7.  
  8. <cfdocumentitem type="header">
  9. <cfset Page = cfdocument.currentpagenumber>
  10. </cfdocumentitem>
  11.  
  12. <cfdocumentitem type="footer" >
  13. FOOTER !!!!
  14. </cfdocumentitem>
  15.  
  16. <table>
  17. <tr>
  18. <td>HELLO</td>
  19. <td> Page No : #Page#</td>
  20. </tr>
  21. </table>
  22.  
  23. </cfdocumentsection>
  24. </cfoutput>
  25. </cfdocument>



Output :

No Error on PDF , but value of Page is blank. I do not get the value of cfdocument.currentpagenumber in Page.


3)
  1. <cfdocument format="pdf" orientation="landscape" unit="cm" margintop="4.0" marginbottom="2.0" marginleft="2.2" marginright="2.2"
  2. scale=99 filename="c:\test.pdf" overwrite="yes">
  3. <cfoutput>
  4. <form>
  5. <input type="hidden" id="hdnPage" />
  6. <cfdocumentsection>
  7. <cfdocumentitem type="header">
  8. <cfset Page = cfdocument.currentpagenumber>
  9. </cfdocumentitem>
  10.  
  11. <cfdocumentitem type="footer" >
  12. FOOTER !!!!
  13. </cfdocumentitem>
  14.  
  15. <table>
  16. <tr>
  17. <td>HELLO</td>
  18. <td> Page No : #Page#</td>
  19. </tr>
  20. </table>
  21.  
  22. </cfdocumentsection>
  23.  
  24. </form>
  25. </cfoutput>
  26. </cfdocument>
Output : ERROR :
Variable HDNPAGE is undefined.
at line : <td> Page No : #hdnPage#</td>

Thanks in advance.
Last edited by peter_budo; Aug 3rd, 2009 at 12:38 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC