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
AJAYAJAY 

page number issue

Hi I am going through a requirement where i have to render a visual force as PDF and on the first two pages of the PDF the page numbers should not be visible and it should start from the third page onwards (3 of 30)  like that. Right now i am displaying it on all the pages. But no idea on how to hide it from the first two pages. I tried if conditions in css and used javascript not getting it. Help is much appreciated.


Thanks,
Ajay.
NagendraNagendra (Salesforce Developers) 
Hi Ajay,

Salesforce PDF generation supports the:first-page pseudo-class(https://developer.mozilla.org/en-US/docs/Web/CSS/:first).

Here is an example (tested using API 34) where the page number is not displayed on the first page:
@page:first{
    @top-right {
      
      content: counter();
          font-weight: lighter;
          font-size:8pt;
        }
    } 

@page {
    @top-right {
      
      content: "Page " counter(page) " of " counter(pages);
          font-weight: lighter;
          font-size:8pt;
        }
    }
Hope this helps.

Please mark this as solved if the information helps.

Thanks,
Nagendra