How do I display only first and last initials from a signature in a PDF mapping?
Last updated: May 29, 2026
When a PDF has an Initial here field instead of (or alongside) a full signature, you can map the signature to that field and use a LiquidJS expression to render just the first and last initials.
How PDF field mappings render values
Every PDF field mapping in Onboarded is a LiquidJS expression. When the form is submitted and the PDF is generated, Onboarded runs your mapping template through the LiquidJS engine — the answer values from the form are the data, and whatever the template returns is what gets stamped into the PDF field. That means you're not limited to dragging a field on and accepting the default output. You can transform the value with filters: format a date, capitalize a string, concatenate fields, or — in this case — slice a name down to two initials.
This article walks through that initials pattern end-to-end. Future Forms articles will build on the same LiquidJS-in-mapping idea for other transformations.
Steps
There are three phases: locate the PDF initials field, drag the signature onto it to get the default mapping, then replace the default template with the initials expression.
Map the signature to the initials field
Open the form in the editor and switch to the
PDFtab to load the PDF mapping view.Find the PDF field labeled
Initial here(or whatever the source document calls it). It will show up as an unmapped field in the right-hand list.From the field templates panel, drag the signature field onto the initials field. When prompted, choose
Signature Name(notSignature Date).You should see Onboarded fill in a default template that looks like this:
{%- if form.employee_signature -%}\n\t{{ form.employee_signature.name }}\n{%- endif -%}The exact path will match your signature field's slug — for example
form.federal_w4_signatureorform.ct_withholding_employee_signature.
Replace the default template with an initials expression
Click the initials field to open its mapping editor. You'll see the default
{{ ...signature.name }}template.Replace it with this expression, swapping in your own signature path:
{%- if form.employee_signature -%}\n\t{{ form.employee_signature.name | split: ' ' | first | slice: 0, 1 }}{{ form.employee_signature.name | split: ' ' | last | slice: 0, 1 }}\n{%- endif -%}The
split: ' 'filter breaks the rendered name into an array of words.firstgrabs the first word,lastgrabs the last word, andslice: 0, 1takes the first character of each. The two outputs sit next to each other with no space between them.Save the mapping.
This expression runs at PDF render time, not at form submit time. The signature field has to actually be filled at the moment Onboarded generates the PDF — if the signature is conditional and the candidate skips it, form.employee_signature will be empty and the initials field will render blank. The outer {%- if -%} guard keeps that from showing as undefined or an error.
Why this handles middle names
Slicing the raw string with slice: 0, 2 would only work if the candidate always types two names with no middle name. John Q Doe would render as Jo, not JD. Splitting on whitespace and taking the first and last words handles middle names, hyphenated names, and any name with three or more words correctly.
Verify
Preview the PDF from the form editor with a test answer where the signature name is John Doe. The initials field should render as JD. Try a three-word name like John Quincy Doe — it should still render as JD, not JQ.
If the field renders blank, the most likely cause is that the signature itself wasn't captured on the test submission. Check that the source signature field is filled, then re-preview.