Generating dynamic data into PDF Template

rimarishi0803
Tera Contributor

 

Hello @there,

I have a requirement as below. How can we,

  • have a PDF template?
  • generate / update the content in that PDF?

I am seeking some suggestions on how it can be done. Your inputs are appreciated. Thanks!

5 REPLIES 5

M Iftikhar
Tera Sage

Hi @rimarishi0803 ,
You can achieve PDF generation and updates in ServiceNow through multiple approaches, depending on how dynamic or automated you want the process to be:

1. Using Document Templates (Recommended OOB option)

  • Navigate to Document Templates to create a template.

  • Design a Word or PDF layout and use field placeholders to dynamically populate record data.

  • This is the most straightforward option for business documents like letters, reports, or acknowledgments.

2. Using the sn_pdfgeneratorutils API (Dynamic PDF Generation)

  • For more control or custom layouts, use the PDF Generation API (sn_pdfgeneratorutils.PDFGenerationAPI) to convert HTML content into PDF and attach it to a record.

  • This approach is ideal when you need to dynamically generate or update PDF content based on record data or system logic.

  • The API also supports headers, footers, page numbering, custom fonts, and images for rich formatting and branding.

3. Using UI Actions or Scripted REST APIs

  • Add a UI Action (e.g., “Generate PDF”) on record forms to allow users to trigger PDF creation manually.

  • Alternatively, use a Scripted REST API to generate and return the PDF programmatically, for external or automated integrations.

For more details and best practices, refer to the following helpful resources:

If my response helped, please mark it as the accepted solution so others can benefit as well. 

Thanks & Regards,
Muhammad Iftikhar

If my response helped, please mark it as the accepted solution so others can benefit as well.