Reputation: 1269
How do I add blank spaces inbetween character? I'm using a PDF/AcroField;
See the routing field, I'd like to make "12345" into "1 2 3 4 5".
Javascript is allowed to validate forms, so maybe I can use that?
Upvotes: 0
Views: 152
Reputation: 13497
There are many ways to add blank spaces in between characters.
var string = "12345";
string.split('').join(' '); // String.split + Array.join
string.replace(/(.)/g, "$1 ").trim(); // Regex
You could also use a for-loop. etc.
As for your follow-up question about how to read AcroField values, based on this Stack Overflow post I'd suggest trying something like this:
PdfReader reader = new PdfReader( pdfPath );
AcroFields fields = reader.getAcroFields();
Set<String> fldNames = fields.getFields().keySet();
for (String fldName : fldNames) {
System.out.println( fldName + ": " + fields.getField( fldName ) );
}
Upvotes: 1