0

We are generating PDF using render as PDF in VF page, now we have requirement for dynamic page number on generated PDF. for example page number should start from 30 and end at 35 i.e 6 pages. If generated PDF has more than 6 pages then rest of the page should be numbered as 35 a, 35b, 35c. Please let me know if anyone has idea how this should be done.

1 Answer 1

0

It seems certainly possible with a bit of apex and merge fields. Try something on these lines and kindly tweak if needed.

In apex:

Integer startPageNum = 35;
    
public integeger getPageNum{
   get {
      return startPageNum ++;
   }      
} 
    
List<String> alphabets = new List{'a', 'b', 'c'};
    
public integeger getAlphabetSequence{
   get {
      alphabets[i++];
   }      
} 

In VF:

IF(!PageNum > 35, PageNum, AlphabetSequence)
2
  • Thanks for replying but how we can set this PageNum variable at footer of VF page. We have single Vf page which breaks into multiple pages on this basis of content when generating PDF Therefore, we are using @Page Css to populate page number in PDF. In this use case how we can achieve this functionality?
    – user55180
    Sep 7, 2021 at 17:58
  • @user55180 : That is good information to know. It would be more helpful and probably seen by more people who could potentially help, if you were to edit your question to include it. When you are trying to get other people to help with technical issues here, more information is (usually) better than less information.
    – Moonpie
    Sep 7, 2021 at 21:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .