How to Auto-Format an Ontario Driver's License Field in PDF Forms
Question details
The user needs a method to configure a PDF text field so that it automatically inserts hyphens to match an Ontario Driver's License format (XXXXX-XXXXX-XXX).

- Product
- PDF Form Editors
- Device & OS
- not provided
- Scenario
- Creating or modifying an interactive PDF form where an identification number requires a specific hyphenated visual layout.
- Observed behavior
- The user wants the field to automatically format the entered digits with hyphens in specific positions without relying on a full custom JavaScript formatting script.
Ensure you are using a PDF editor with advanced interactive form editing capabilities that allow you to modify text field properties and apply special format masks.
Use an Arbitrary Mask in Field Properties
Configure a special format mask within the text field's properties to automatically insert hyphens as the user types, completely bypassing the need for custom JavaScript.
PDF interactive forms include built-in masking features that enforce how entered data is displayed. By using an arbitrary mask, you can define exactly where characters are allowed and where static separators like hyphens should automatically appear.
Open your PDF in form editing mode, right-click on the target text field, and select 'Properties' from the context menu.
In the Properties dialog box, click on the 'Format' tab at the top to view formatting options.
Click the 'Select format category' drop-down menu and choose 'Special'.
Under the special options that appear, select 'Arbitrary Mask'. In the mask input box, type '99999-99999-999'. The '9' characters instruct the field to accept digits, while the hyphens will be automatically placed in the required positions.
Click 'Close' to save the properties. Exit form editing mode and type a 15-digit number into the field to verify that the hyphens automatically populate.

Create and Format Interactive PDF Forms Easily with WPS Office
WPS PDF provides a comprehensive and user-friendly toolkit to create, edit, and format interactive PDF forms. You can easily insert text fields, apply custom formatting masks, and ensure precise data entry without writing any code.
- 1. Open your PDF: Launch WPS Office and open your PDF document using the WPS PDF tool.
- 2. Enter Form Mode: Navigate to the 'Form' tab on the top ribbon to access interactive form tools.
- 3. Insert a Text Field: Click 'Text Field' and drag your cursor on the document to draw a new input field.
- 4. Edit Properties: Double-click the newly created text field to open its properties, go to the 'Format' tab, and apply your custom formatting.

Frequently Asked Questions
What characters can I use in an Arbitrary Mask for PDF forms?
In most standard PDF form editors, '9' accepts only digits (0-9), 'A' accepts alphanumeric characters (letters and digits), 'O' accepts only letters (A-Z), and 'X' accepts any printable character. Hyphens, slashes, or spaces are treated as static display characters.
Can the XXXXX-XXXXX-XXX format be customized like the US Social Security number?
Yes. While standard formats like the US Social Security Number or ZIP codes are often pre-built into the 'Special' format category, an arbitrary mask lets you create any custom pattern, such as XXXXX-XXXXX-XXX, achieving the exact same automatic formatting behavior.
Why aren't the hyphens appearing as I type into the field?
Depending on the PDF reader, mask formatting may only visibly trigger after you finish typing and click outside (or tab out of) the text field. Additionally, if a user types a character that violates the mask rule (like typing a letter in a '9' digit-only mask), the formatting might fail or reject the input.




