1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.
  2. Better Analytics for WordPress Get It Free

How to repeat table header on each page of PDF using Coldfusion

Discussion in 'Programming' started by Renu Deshpande, Aug 2, 2009.

  1. #1
    Hi all,
    Can anybody help me in resolving this issue. The details are mentioned below.

    I am generating PDF using <cfdocument> tag of Cold Fusion.
    I have a header and footer to be displayed on each page. I am rendering data in a table.
    If rows in the table exceed a page , and continue on the next page , I want the table headers to be repeated on each of the page.

    Example :
    Currently this is happening:

    Page Header

    Some text .....

    Column1 Header Column2 Header --- {Table headers}
    A B
    C D

    Page Footer : Page No 1

    Page Header

    E F

    Page Footer : Page No 2

    What I want is this :

    Page Header

    Some text .....

    Column1 Header Column2 Header --- {Table headers}
    A B
    C D

    Page Footer : Page No 1

    Page Header

    Column1 Header Column2 Header --- {Table headers}
    E F

    Page Footer : Page No 2

    Thanks in advance
     
    Renu Deshpande, Aug 2, 2009 IP
  2. gavy

    gavy Peon

    Messages:
    50
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    OK are u using Coldfusion 7 oer Coldfusion 8:

    Coldfusion 8 has many features which can make ur document read exactly as u want them too.

    i prefer u go to this site:

    cfquickdocs.com

    u will definately get ur answer
     
    gavy, Aug 2, 2009 IP
  3. Renu Deshpande

    Renu Deshpande Guest

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi Gavy,

    Thanks for ur inputs. I am using Coldfusion 8
    I tried searching the link , but my problem remains unsolved.

    The main issue is I am setting a variable in <cfdocumentitem type="footer" > , but I can not get the updated value of the variable outside the <cfdocumentitem> tag.

    Example :

    <cfdocument format="PDF">
    <cfoutput>
    <cfset Page = 1>
    <cfdocumentsection>
    <cfdocumentitem type="header">
    HEADER <cfoutput>#cfdocument.currentpagenumber#</cfoutput>
    </cfdocumentitem>
    <table>
    <cfloop index = "i" from="1" to="500">
    <tr>
    <td>HELLO</td>
    <td> Page No : #Page#</td>
    </tr>
    </cfloop>
    </table>
    <cfdocumentitem type="footer" >
    FOOTER
    <cfset page = page+1>
    </cfdocumentitem>
    </cfdocumentsection>

    Current Output :

    HEADER 1

    Hello Page No 1
    Hello Page No 1
    Hello Page No 1
    Hello Page No 1
    Hello Page No 1
    Hello Page No 1

    FOOTER


    HEADER 2
    Hello Page No 1
    Hello Page No 1
    Hello Page No 1
    Hello Page No 1
    Hello Page No 1
    Hello Page No 1

    FOOTER

    The desired output is :

    HEADER 1

    Hello Page No 1
    Hello Page No 1
    Hello Page No 1
    Hello Page No 1
    Hello Page No 1
    Hello Page No 1

    FOOTER

    HEADER 2

    Hello Page No 2
    Hello Page No 2
    Hello Page No 2
    Hello Page No 2
    Hello Page No 2
    Hello Page No 2

    FOOTER

    How can I get the value of variable Page which has been updated in <cfdocument item type = "footer"> tag ??

    Thanks in advance
     
    Renu Deshpande, Aug 2, 2009 IP
  4. cfStarlight

    cfStarlight Peon

    Messages:
    398
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    As mentioned on one of your other threads,
    a) it is not possible to access currentpagenumber outside of the cfdocumentitem tag
    b) it is not possible to repeat the table headers unless you can find a supported css attribute for this

    (Geez. You sure posted your questions to a _lot_ of forums)
     
    cfStarlight, Aug 4, 2009 IP