@L veerasivareddy 

the links I shared are useful in generating custom PDF

Did you have a look on those?

It has sample scripts as well.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader