Getting Started with Yansa PDF Generator

Yansa Labs recently released the all-new Yansa PDF Generator, available now on the ServiceNow Store.

This product is borne from our experience working with dozens of organizations across numerous verticals and use-cases. One need that seems to exist everywhere we go is the ability to easily create precise, beautiful PDF documents from data in ServiceNow. The existing options are either too ham-fisted – capable of generating PDFs, but sloppily so – or too complex and code-heavy for a typical user to comprehend. With Yansa PDF Generator, we aim to bring power and precision together with a great user experience so that document creators, not coders, can tap into the power and wealth of data within ServiceNow!

When you first install Yansa PDF Generator, you’ll be greeted with a new module in your left nav. The jumping-off point to start creating your own data-driven PDFs is the Yansa PDF Generator -> HTML to PDF Merge Templates module. Click this module to take a look at the sample content we include with the app.

HTML to PDF Templates
HTML to PDF Merge Templates

Clicking into the Sample: Employee Offer Letter template, you’ll see a few available fields at the top of the form, the most crucial of which is Source table. Every PDF template requires a source table from which the template will pull and merge data dynamically from records in ServiceNow. In this case, it is the User table.

Sample: Employee Offer Letter

Scroll further to find the HTML template field within the Content tab, which is where you will design the content of your PDF. Our designer is based on the TinyMCE utility you’ll find elsewhere in ServiceNow, but customized (and customizable) to allow greater power and flexibility. As you build your template, consider the data that will be dynamically inserted from the source record and insert placeholders for those fields as ${PLACEHOLDER_NAME}, where the name can be anything you like.

HTML Template

Once you’ve drafted some content, it’s time to start mapping data! Scrolling further down will bring you to the related list for PDF Template Merge Maps – these are merge fields to correlate data to the placeholders you included in your content, where the Merge key is the name you indicated in your ${PLACEHOLDER_NAME} tags above. Merge maps are extremely flexible – there are various types to be used/reused according to your needs. See below for descriptions and a couple of example configurations:

  • Source Record Attribute: Map directly from a field on a table, with access to value types specific to the field type (currency, time, etc)
  • Static: Static text
  • HTML: Static rich text
  • Scripted: HTML/text generated via server script for maximum flexibility
  • Pre-Defined: Any of the above, but pre-defined and reusable – great for oft-used functional chunks of content

Once your content is built, it’s time to frame your PDF into a document. For this, you’ll switch to the Page Configuration tab. Here, you’ll see a plethora of options for defining your page size, specific margins, and header/footer configurations – this includes options like page numbers & logos to brand your documents specifically for your organization or department.

Page Configuration

Now for the fun part! Once your document is designed, it is time to see the fruits of your labor. Begin by clicking the Generate Sample button in the header of the form to display Yansa’s PDF generation wizard. On step 1 of the wizard, you will be presented with the details of the source table and template, along with a pre-merge render of your document. Continue to step 2 to select any available record from your source table and dynamically generate a render of your document in real-time. Finally, step 3 allows you to download or attach the PDF document to your desktop or a ServiceNow record.

Easy as that, you’ve generated your first PDF document in ServiceNow. What now?

Once you’ve created your first template, you’re a short step away from making this functionality available to your users. We’ve made it easy to add your own Generate PDF button to any form in ServiceNow, allowing your users to utilize our Yansa PDF Generator wizard to preview, generate, and attach/save their own PDFs on-demand. Options are available to control the flexibility of the wizard, ensuring that PDFs always match your organizational standards.

When you’re ready to ramp up productivity and automate creating PDFs at scale, we’ve included a Flow Designer Action, so you can easily tie Yansa PDF Generator into your existing workflows.

Flow Designer Action

That’s Yansa PDF Generator in a nutshell! We’ve left some functionality out of this introduction, mainly regarding advanced configuration and how you can more precisely define your PDF content and layout. We’ll save that for a future post.

Under the hood, we’ve left a lot of hooks in place for future functionality. We want to see how our customers use Yansa PDF Generator and grow this solution to be the one-stop shop for all of your document workflows in ServiceNow. Let us know what you’d like to see!

To see more products from Yansa Labs, check out our Yansa Solutions page or visit our apps on the ServiceNow Store.