Have what I hope is an easy question: I have an in...
# advancedpdf
j
Have what I hope is an easy question: I have an integer field that I need to display, but I need to add leading zeroes. Someone will put "2" into the form field, but I need it to print "000002". Any way to accomplish that in the advanced pdf code? Or do I need to modify the field itself before printing?
s
Freemarker provides method for formatting numbers using the
?string
built-in: https://freemarker.apache.org/docs/ref_builtins_number.html#ref_builtin_string_for_number
j
Awesome thanks!
s
To always display six digits, I think you'd use something like:
${numberField?string["000000"]}
It's based off of the Java decimal formats, so you can always look up the correct syntax for the format you want