I created pdf file using visualforce renderAs. In visualforce I have a table tr in apex:repeat and below that table one DIV tag. This div tag appears at bottom of the page when there is content only in single page. But when content going out of first page(content in td) I want DIV tag at bottom of second page only not for first page. I have following code:

<apex:page showHeader="false" renderAs="pdf" applyhtmltag="false" applyBodyTag="false" standardController="Opportunity" extensions="Invoice_PDF_Controller" action="{!doDmlht}">

    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
    <style type="text/css" media="print">
    @page {
        border: 2px solid black;

        @top-center {
            content: element(header);

        @bottom-left {
            content: element(footer);

    div.header {
        padding: 10px;
        /*margin-top: 50px*/
        position: running(header);

    div.footer {
        display: block;
        padding: 0px;
        position: running(footer);

    .pagenumber:before {
        content: counter(page);

    .pagecount:before {
        content: counter(pages);

                    <td>some content..</td>
        <div style="position: fixed;bottom: 0;">
            some content..


I used style="position: fixed;bottom: 0;" for last div but it also appears for first page. I tried many ways but not use.

  • try using HTML <footer> and let me know if it works.
    – MIX DML
    Jul 8, 2019 at 9:21
  • Hey MIX! thanks for reply. when i use <footer> it appers at top of the second page not to bottom. i want it to locate at bottom.
    – jsmith
    Jul 8, 2019 at 9:27
  • I did it by adding <footer style="position:absolute; top:1790px;"> but it will fail if content in td have in second page upto bottom then footer will appear at top of the third page.Please provide ultimate solution for it.
    – jsmith
    Jul 8, 2019 at 10:28
  • I think only way solve this issue is to create sticky footer. Please refer below link : w3schools.com/howto/tryit.asp?filename=tryhow_css_fixed_footer
    – MIX DML
    Jul 8, 2019 at 11:08
  • I tried that too but it added footer also for first page.I want to add footer only for bottom of the last page.
    – jsmith
    Jul 8, 2019 at 11:11


You must log in to answer this question.

Browse other questions tagged .