function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Alok_NagarroAlok_Nagarro 

Pagination within PDF

Hi All,

 

I have a VF page with specified rerenderAs attribute to 'pdf ' .I am fetching accounts and displaying  within data table in this page. And i want to pagination within PDF. I tried a lot but i couldn't get success.

 

If anyone can, then please guide me.

 

Thanks.

Jeremy.NottinghJeremy.Nottingh

To put a page break into your pdf, insert this line as appropriate:

<div style="page-break-after: always;" />

 

Let me know if that doesn't answer your question.

 

Jeremy

Alok_NagarroAlok_Nagarro

Hi,

 

Thanks for reply.

I post my code,wat i m trying to do.Please tell me where i have to insert <div style="page-break-after: always;" /> in my code.

 

<apex:page controller="AcountPDF" renderAs="pdf">
<head>
<style>
@page
{
@bottom-right
{
content: "Page: " counter(page) " / " counter(pages);color: green;font-size: 80%;
}
@top-center
{
content: "Accounts List"; color: green; font-size: 150%;font-family: 'Helvetica';font-weight: Bold;
}
@top-right
{
content: "Date: {!Day(Today())} - {!Month(Today())} - {!Year(Today())}";color: green;font-size: 80%;
}
}
</style>
</head>


<apex:outputPanel id="dt">
<apex:dataTable value="{!AccountList}" var="acc" bgcolor="#8E9DBE" border="1px" cellpadding="10" columnsWidth="20" styleClass="columnHeader" rowClasses="odd,rowdata">
<apex:column headerValue="Account Name" value="{!acc.Name}" styleClass="columnValue"/>
<apex:column headerValue="Phone" value="{!acc.Phone}"/>
<apex:column headerValue="Primary Address" value="{!acc.HOC__Primary_Address__c}"/>
<apex:column headerValue="Industry" value="{!acc.Industry}"/>
</apex:dataTable>
</apex:outputPanel>

</apex:page>

 

Thanks.

Vanessa BarrosVanessa Barros

 

Hi.
you have to put a ; after counter(page) like this

 

@bottom-center {
font-size:13px;
color: #9C9C9C;
font-family: Trebuchet MS, sans-serif;
content: "Pág." counter(page);

}

 


Alok_vibrant wrote:

Hi,

 

Thanks for reply.

I post my code,wat i m trying to do.Please tell me where i have to insert <div style="page-break-after: always;" /> in my code.

 

<apex:page controller="AcountPDF" renderAs="pdf">
<head>
<style>
@page
{
@bottom-right
{
content: "Page: " counter(page) " / " counter(pages);color: green;font-size: 80%;
}
@top-center
{
content: "Accounts List"; color: green; font-size: 150%;font-family: 'Helvetica';font-weight: Bold;
}
@top-right
{
content: "Date: {!Day(Today())} - {!Month(Today())} - {!Year(Today())}";color: green;font-size: 80%;
}
}
</style>
</head>


<apex:outputPanel id="dt">
<apex:dataTable value="{!AccountList}" var="acc" bgcolor="#8E9DBE" border="1px" cellpadding="10" columnsWidth="20" styleClass="columnHeader" rowClasses="odd,rowdata">
<apex:column headerValue="Account Name" value="{!acc.Name}" styleClass="columnValue"/>
<apex:column headerValue="Phone" value="{!acc.Phone}"/>
<apex:column headerValue="Primary Address" value="{!acc.HOC__Primary_Address__c}"/>
<apex:column headerValue="Industry" value="{!acc.Industry}"/>
</apex:dataTable>
</apex:outputPanel>

</apex:page>

 

Thanks.


 

Vanessa BarrosVanessa Barros

this code is to break the page " <div style="page-break-after: always;" />"

And put this 

<style type="text/css">

after the <head> and close

 </style>

before </head>