I am trying to find out which formats a date of birth should be in a empty field in a PDF using iText,
I can stamp the field with a value but then need to know what the date of birth must be.
I figured that if I get out the length of the field so I know how the format should be, because the formats can be:
YYYYMMDDNNNN (14 digits)
YYYYMMDD (10 digits)
YYMMDD (8 digits)
The field has a fixed number of digits, if I stamp the field with too many numbers, then the numbers that fall outside the field disappears.
How do I find the length of the empty field?
how i stamp the field:
private void stampValuesOnFields()
{
try
{
PdfReader reader = new PdfReader(System.getProperty("com.sun.aas.instanceRoot") + "/PDF/Templates/org.pdf");
String path = System.getProperty("com.sun.aas.instanceRoot") + "/PDF/Generated PDF/" + "new.pdf";
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(path));
stamper.getAcroFields().setField("field", "19321029");
}catch(Exception e)
{}
}
Here are pdfs I try to fill in, but I want it to work for other pdf files with other formats of Birthday:
http://www.korkortsportalen.se/upload/dokument/blanketter/foretag/tstrk1031_lakarintyg_diabetes.pdf ( the field under "Sökandens personnummer" )