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
BritishBoyinDCBritishBoyinDC 

pdf and page numbers not displaying...

So I have previously managed to get a vf page rendered as pdf using standard apex page blocks to show page number when in landscape mode...but can anyone shed some light on why this seemingly simpler test doesn't display page numbers...? I've tried it in various instances, but no joy...any insights appreciated.

 

CSS, loaded as static resource test7

 

 

<style type="text/css"> @page { @top-right { /* page numbers */ content: "Page " counter(page); } } </style>

 

 

Page

 

 

<apex:page standardController="Account" renderas="pdf"> <apex:stylesheet value="{!$Resource.test7}"/> This is test text for {!account.name} <div style="page-break-after: always;">&nbsp;</div> This is test to show page 2 </apex:page>

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
BritishBoyinDCBritishBoyinDC

So somehow this code is now working for me...if anyone else is in need:

 

 

<apex:page standardcontroller="Contact" renderas="PDF" tabstyle="Contact"> <head> <style type="text/css"> @page { @bottom-center { font-size: 8pt; } @bottom-right { content: "Page " counter(page) "/" counter(pages); font-size: 8pt; } } </style> </head> <apex:stylesheet value="{!$Resource.capportrait10}"/> <apex:outputPanel STYLE="font-size: x-large;"> {!contact.Firstname} {!contact.Lastname} </apex:outputPanel> <apex:pageBlock > ...Rest of page </apex:pageBlock> </apex:page>

 

 

 

All Answers

BritishBoyinDCBritishBoyinDC

So somehow this code is now working for me...if anyone else is in need:

 

 

<apex:page standardcontroller="Contact" renderas="PDF" tabstyle="Contact"> <head> <style type="text/css"> @page { @bottom-center { font-size: 8pt; } @bottom-right { content: "Page " counter(page) "/" counter(pages); font-size: 8pt; } } </style> </head> <apex:stylesheet value="{!$Resource.capportrait10}"/> <apex:outputPanel STYLE="font-size: x-large;"> {!contact.Firstname} {!contact.Lastname} </apex:outputPanel> <apex:pageBlock > ...Rest of page </apex:pageBlock> </apex:page>

 

 

 

This was selected as the best answer
dhritidhriti

Hi Can we have page numbers in body rather than bottom or top of page ?