Help Displaying 1 character on PDF at a time.

10 July, 2020 09:33:40
SteveC
Topics: 9
Messages: 63
Hi I have a PDF form that request a 10 digit number and displays them 1 digit at a time in boxes. Please see pic.

Is there anyway to draw a box and display 1 character from a field at a time so I can actually get them to display correctly on the PDF?

Thank you!
11 July, 2020 04:20:20
E2Pdf
Support
Topics: 7
Messages: 3163
Hi,

Yes, it's possible to use "Combination of Characters" field. To setup it, you must set the length of field and "Comb" checkbox. (screenshot 1).

As you have "-" between fields, you will need to create 5 fields.

First length 1 and other fields with length 3 + "Comb" checkbox must be checked for all fields. If in entry you have 1 number, you can split number via "Preg Match All" filter. (screenshot 2)

Value: Will be same for all fields (Your Field ID)
"Preg Match All Pattern" will be same for all fields: /(\d{1})(\d{3})(\d{3})(\d{3})(\d{3})/

Preg Match All Output:
1st field: 1.0
2nd field: 2.0
3rd field: 3.0
4th field: 4.0
5th field: 5.0

Result attached on screenshot 3

Or another solution can be just to use "Preg Filter" to split value to 1 character at a time and put 13 different fields by example above and changing "Preg Match All Pattern" to:
/(\d{1})(\d{1})(\d{1})(\d{1})(\d{1})(\d{1})(\d{1})(\d{1})(\d{1})(\d{1})(\d{1})(\d{1})(\d{1})/

We remain at your service.


We would really appreciate your feedback at WordPress.org!
13 July, 2020 16:42:42
SteveC
Topics: 9
Messages: 63
Hi thank you for the response.

I tried to follow both options that you gave me but I must be doing something wrong. I have attached pictures of my Properties window for my field. It is the same 13 length field in my first post.

I wanted to use the second option you described of splitting value to 1 characters at a time and putting 13 different fields - but I can not get anything to display. Does it matter what "PDF Builder" "Field" type I use? I tried many but no difference.
13 July, 2020 23:54:40
E2Pdf
Support
Topics: 7
Messages: 3163
Hi,

Can you please create "Input" field under E2Pdf Template with just [11] as value, and copy its output here please? Thank you.

We remain at your service.
We would really appreciate your feedback at WordPress.org!
14 July, 2020 01:29:36
E2Pdf
Support
Topics: 7
Messages: 3163
As an additional solution we just released update under Release Candidate version 1.11.04.3 which has new "substr" filter for [e2pdf-format-output] shortcode wrapper, which must make easier to accomplish current task.

This version can be currently updated from E2Pdf.com by enabling option: "E2Pdf" -> "Settings" -> "Release Candidate Builds" (screenshot attached).

After update you must be able to use such constructions:

1st letter:
[e2pdf-format-output substr="0,1" filter="trim,substr"][11][/e2pdf-format-output]

2nd letter:
[e2pdf-format-output substr="1,1" filter="trim,substr"][11][/e2pdf-format-output]

3rd letter:
[e2pdf-format-output substr="2,1" filter="trim,substr"][11][/e2pdf-format-output]

and so on...

We remain at your service.


We would really appreciate your feedback at WordPress.org!
14 July, 2020 06:23:24
SteveC
Topics: 9
Messages: 63
Hi. Thank you for making that change.

So I have followed the instructions and the field do display 1 digit but it is always the first digit for me. I have the shortcode changed as your example recommends. Attached is a picture of the 4th fields properties box from my form. This field like the other 3 only display the 1st characters from the input field. Can you advise if I am missing something?
14 July, 2020 07:16:01
E2Pdf
Support
Topics: 7
Messages: 3163
We do not have any issues with test. (screenshots attached).

Which data do you get while using just [11] shortcode?

Did you remove old data under "Preg Filters"?

We remain at your service.


We would really appreciate your feedback at WordPress.org!