I have created a visualforce page rendered as PDF.But in PDF the first page is showing with lot of whitespace on the top and in the remaining pages the border on the top is not displaying . i think -fs-table-paginate:paginate; which i use for displaying the header in all pages is creating problem.

here is the code i am using

<apex:page controller="TestPDFController" standardStylesheets="false" showHeader="false" sidebar="false" applyHtmlTag="false" applyBodyTag="false" renderAs="pdf" readOnly="true">
        <style type="text/css">
            @page {

                margin-top: 1.0in;
                margin-bottom: 1.0in;
                margin-left: 1.0in;
                margin-right: 1.0in;
                   counter-increment: page;
                @bottom-right {
                    content: "Page " counter(page)

            body {
                font-family: Arial, sans-serif;

                color: #000;

            .dataTableClass {            

       -fs-table-paginate: paginate;
          width: 100%;

            .dataTableClass th, .dataTableClass td {
                vertical-align: top;
                text-align: left;
            .dataTableClass .dtColHeader {
                font-size: 15pt;
                font-weight: bold;
            .dataTableClass .dtColData {
                font-size: 9pt;

        <apex:outputPanel layout="block" rendered="false">
            <h3>By including these lines the table header...</h3>
            <h3>...renders as expected on all pages</h3>
        <apex:dataTable value="{!accounts}" var="rec" styleClass="dataTableClass" >
            <apex:facet name="header">
                <h3 style="text-align: center;">List of Accounts and Owners</h3>
            <apex:column style="width: 60%;">
                <apex:facet name="header">
                    <apex:outputText value="Account Name" styleClass="dtColHeader" />
                <apex:outputText value="{!rec.Name}" styleClass="dtColData"/>
            <apex:column style="width: 40%;">
                <apex:facet name="header">
                    <apex:outputText value="Owner Name" styleClass="dtColHeader" />
                <apex:outputText value="{!rec.Owner.Name}" styleClass="dtColData" />


Please help. If i remove -fs-table-paginate:paginate no header is displayed.

Regards khan

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.