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
arunadeveloperarunadeveloper 

How display page number on visualforce PDF

Hi Team,

 

when i click a custom button it will generates the PDF.

on the PDF I would like to generate page numbers.

I am putting below code

 

<head>
<style type="text/css">
@page
{

size:landscape;

@bottom-right {
content: "Page " counter(page);
}
}
</style>
</head>

 

But it is not showing numbers on pdf, please can any one suggest me how to display number on visualforce pdf.

 

Thanks

Best Answer chosen by Admin (Salesforce Developers) 
testrest97testrest97

put it in static resource and refer in pdf

 

<apex:stylesheet value="{!Resource.externalCss}"/>

 

css file:

@page
{

size:landscape;

@bottom-right {
content: "Page " counter(page);
}
}

 

All Answers

testrest97testrest97

put it in static resource and refer in pdf

 

<apex:stylesheet value="{!Resource.externalCss}"/>

 

css file:

@page
{

size:landscape;

@bottom-right {
content: "Page " counter(page);
}
}

 

This was selected as the best answer
gautam_singhgautam_singh

Hi,

 

Try to put the css file in static resource and use that in the visualforce page rendering as PDF through this

 

<apex:stylesheet value="{!$Resource.myCss}"/>

Also,  Refer this Blog for more customizations. You can also check this Repository from w3's .

This will solve your query.

 



Important :

Click on the Star Icon aside if this post provides you with useful information and if this is what you where looking for then please mark it as a solution for other benefits.

Thank You