PDF template merging

What this feature does

A form can carry a PDF template: an existing, fixed layout document such as a government, immigration or tax form. You position each form question onto the pages of that PDF in the builder, and when someone submits the form the answers are drawn into those positions. The result is attached to the Form Response as a completed copy of the official document, and offered to the submitter as a download on the completion screen.

This is a third, separate PDF capability. It does not replace either of the existing ones. See Form to PDF and PDF to form for how the three compare.

Feature Direction Output
Form to PDF Submission out A rendered picture of the form and its answers
PDF to form Document in A new form definition built from a PDF
PDF template merging Submission out The original PDF document, filled in

Use PDF template merging when the exact document matters, for example when a submission must be printed and filed on the official layout. Use Form to PDF when you only need a readable record of what was submitted.

Setting it up

There are three steps: attach the PDF, map the fields, save the form.

1. Attach the PDF template

In the builder toolbar there is a PDF file action. It opens the PDF Template panel, where you can drop a PDF onto the drop zone or browse for one.

Rules the panel enforces:

Once uploaded, the panel shows the file name, size and upload date, and one of these states:

Badge Meaning What to do
(none) The form definition points at this exact PDF version Nothing
Unsaved The upload or replacement is queued Click Save in the builder
Detach queued The detach is queued Click Save in the builder
Not linked A PDF sits on the record but the form does not use it Click Link to form, then Save

The Not linked state happens when a PDF was uploaded but the builder was reloaded before saving. The pending change is lost with the page, and Link to form is the way back.

Replace uploads a new version of the same file. Detach removes the PDF from the form definition but leaves the file on the Form record, so an older form version that still references it keeps working and the action can be undone.

2. Map the fields

Attaching a PDF reveals a PDF Mapping tab, after the Translations tab. Detaching hides it again. The tab shows every page of the PDF in one continuous scroll, with the form's fields listed alongside.

Drag a field from the list onto a page to place it. Each placement is one box on one page. The same question can be placed as many times as you like, which is what multi page official forms usually need.

Toolbar controls:

Control Purpose
Preview with sample data Redraws the pages with stand in answers so you can check positioning. Boxes are hidden while previewing
Save Saves the form, through the same path as the builder's own Save button
Zoom 50% to 200%. Placements are stored as a share of the page, so zoom never affects the result

Working with placements:

3. Save the form

Nothing is written to the form definition until you click Save. The attachment, the placements and the settings are all part of the form definition, so they travel with the form's version history and its export. Rewinding a form to an earlier version restores the PDF template and mapping that version was built with.

Which fields can be placed

A placement writes one answer into one box, so a question qualifies only if it has exactly one value per submission.

Placeable question types: single line text, comment (multi line), dropdown, radio group, checkbox, tag box, yes/no, rating, and signature.

Not placeable, and shown greyed out with the reason rather than hidden:

Type Reason
HTML, image Display only element with no answer
Image picker Image choices are not supported on a PDF
File upload File uploads cannot be drawn into a PDF
Multiple text Multi text groups are not supported yet
Expression Calculated values are not supported yet
Anything inside a child object panel The panel holds many rows, so there is no single place to put the answer

Parent object panels and grouping panels are fine. Their questions are listed with the panel title as a path, so two fields both called Email can be told apart.

Choice questions and tick boxes

On a printed form a choice is usually a row of boxes to tick, not a blank to write a word in. So radio groups, checkboxes and yes/no questions list each of their options as its own draggable row in the field list. Drag the option you want and it becomes a tick box for that specific answer.

A dropdown is not expanded that way, because a dropdown on paper is normally a blank the chosen label is written into. You can still switch a dropdown placement to tick mode by hand.

Questions whose choices load from Salesforce at runtime (dynamic dropdowns and lookups) have no fixed option list at design time, so they can only be written as text. See Dynamic dropdowns and lookups.

Placement properties

Select a box to edit how it draws.

All choice and yes/no placements

Property Options Notes
This box Writes the answer, Ticks a box Text writes the chosen label, mark draws a tick
Tick when the answer is The question's options Only in tick mode
Mark Tick, Cross, Filled box Drawn as vector lines, so it renders in any PDF viewer

For a multi select question, a tick box fires when its option is among those chosen, so several boxes for the same question can tick at once.

Text placements

Property Options Default
Date format Use the form PDF date format, US (MM/DD/YYYY), UK (DD/MM/YYYY), EU (DD.MM.YYYY), ISO (YYYY-MM-DD) Inherit the form's PDF date format
Alignment Left, Centre, Right Left
If the answer is too long Shrink to fit, Clip, and Wrap on multi line questions only Shrink to fit
Font size 4 to 72, or blank Blank means size the text to the height of the box

Date format only appears on questions that hold a date or time. Leaving it on the inherited setting means a merged document and a generated Form to PDF cannot disagree about how dates read.

Choice answers are always drawn as the label, never the stored value, so a merged document never shows a record id or an internal option code.

Signature placements

Property Options Default
Signature size Keep its proportions, Fill the box Keep its proportions

Keeping the proportions centres the signature inside its box. Stretching a signature to fill a box of a different shape can make it look altered, which matters on a document someone may have to rely on.

Signatures must be captured in PNG or JPEG. A signature question configured to produce SVG cannot be placed on a PDF, and the merge records a warning instead of drawing it.

PDF template language

Once a form has a PDF template, a PDF Template Language setting appears in the form's general properties.

A submitter may complete a translated form in their own language, but the document that comes out is usually read by someone else, such as a government office or a back office team, who need every copy in one predictable language. This setting pins the option labels drawn onto the page to a single language whatever language the form was filled in.

The dropdown lists Form default plus every language the form has translations for. Form default is correct for a form with no translations, which is why the setting does not need touching until a form gains them.

Only labels are affected. Free text the submitter typed is stored as typed and drawn as typed. Nothing here translates submitted content. See AI translations.

Keeping the mapping healthy

A placement points at a question by name, so editing the form after mapping can break it.

Renames are followed automatically. Renaming a question, including the automatic rename the builder performs when a field is bound to Salesforce, rewrites the affected placements. No positioning work is lost.

Deletions and type changes break the placement. Broken placements are flagged, never silently deleted, because a deletion is usually an edit the admin may want to undo and discarding positioning work quietly is worse than showing a problem.

You are told in three places:

  1. A red dot appears on the PDF Mapping tab, with a tooltip explaining it. This is visible from the Designer, so you see it right after the edit that caused it.
  2. Inside the tab, the field list shows a notice with the count and a Remove broken placements button.
  3. When you click Save, the save dialog warns that fields placed on the PDF no longer exist and that those boxes will be left blank.

The save warning does not block the save. The deletion may well be intentional with the mapping to be tidied afterwards, and refusing to save the rest of the work over it would be worse.

The form definition also records whether the mapping is currently valid, so anything downstream can check it without reimplementing the rules.

What happens on submission

  1. The submission is saved and the Form Response is written first. The merge runs afterwards, so a merge failure can never cost a submission that is already safe.
  2. The PDF template is fetched at the exact version the form is pinned to. Replacing a template on a live form therefore cannot shift every box on submissions already in flight.
  3. Only mapped questions are read. Answers are collected in the PDF Template Language.
  4. Answers are drawn at the mapped positions.
  5. The result is attached to the Form Response as Completed-<template name>.pdf.
  6. The completion screen offers a Download button for the completed document.

The merge runs in the submitter's browser. If it fails, the failure is logged to the browser console, the submission and all Salesforce records are unaffected, and the completion screen simply shows the ordinary completion message with no download offered.

Placements pointing at deleted questions are left blank rather than blocking the document. A document with gaps beats no document.

The output file is deliberately named after the template, not after the Save as PDF file name. That keeps it separate from the Form to PDF output so the two never overwrite each other as versions of one file.

Tracing a document back to its template

Every Form Response records PDF_Version_ID__c, the file version id of the PDF template that submission was merged into. Together with Data_Version_ID__c, which pins the form definition, this lets you reconstruct exactly which template and which form version produced a given document, even after the template has been replaced on the form.

The field is on the Form Response page layout and is empty for forms with no PDF template. See Objects and fields reference.

Guest and public forms

The merge happens in the submitter's browser, so the browser has to be able to download the template file.

For public forms served through a Site, a guest user can only retrieve files above roughly 3 MB when the Large Files service is enabled for the org. The PDF Template panel warns you when the attached PDF is over that size. Below it, no extra configuration is needed. See Files, file handling and attachments.

Character support

Text is drawn using the PDF standard fonts, which cover Western European characters. Characters outside that range, such as Cyrillic, Greek or CJK, are replaced with a question mark and a warning is logged, rather than failing the whole document. If you need those scripts on the page, use Form to PDF instead of a merged template.

Rotated and unusual pages

Pages carrying a rotation are handled correctly. You map against the page as it is displayed to you, and the coordinates are turned back before anything is drawn. A placement whose page number does not exist in the PDF, which can only happen if a shorter PDF replaced a longer one, is skipped with a warning.

Troubleshooting

Symptom Likely cause
No PDF Mapping tab No PDF template is attached, or the attachment was never saved
Panel shows Not linked An upload was lost to a page reload. Click Link to form, then Save
Red dot on the PDF Mapping tab A placed question was deleted or changed to a type that cannot be drawn
Boxes blank on the merged document Those placements point at deleted questions, or the questions were left unanswered
No download on the completion screen The form has no mapping, or the merge failed. Check the browser console
Merged document missing entirely The merge failed. The submission and its records are still correct
Answer text is cut off The placement's overflow is set to Clip, or the box is too small for a fixed font size
Labels in the wrong language Set PDF Template Language on the form
Question marks instead of letters The text uses characters outside the PDF standard font range