Fillable format extraction from pdf
Hi All,
Good day to you!
I am trying to compare fillable form source and draft by extracting the details like filed name, tooltip, tab order, page number and char limit using browser based upload. However I am facing issued in extracting the formats of the fields, Below is the code which gives as "Text" for all field. Is it possible to extract information like SSN, Date...
Note: I use a script to fill the value of the field based on the format then I am doing the compare
const getFieldFormat = (annot) => {
const jsAction = annot.actions?.F || annot.additionalActions?.F || '';
if (typeof jsAction !== 'string') return 'Text';
if (/AFDate_Format/.test(jsAction)) return 'Date';
if (/AFNumber_Format/.test(jsAction)) return 'Number';
const match = jsAction.match(/AFSpecial_Format(\d)/);
if (match) {
switch (match[1]) {
case '0': return 'SSN';
case '1': return 'Phone Number';
case '2': return 'ZIP Code';
case '3': return 'ZIP+4';
default: return 'Special Format';
}
}
return jsAction ? 'Custom JS Format' : "Text";
};
