Using Java and IText, how to extract AcroForm field names from PDF?

I am looking for a simple example API that reads a PDF file / template as input and iterates over fields defined in a PDF form (I think this is called AcroForm)

+4
source share
1 answer

Ok i found a solution

public static void scanFields(String path) throws IOException { PdfReader pdfReader = new PdfReader(path); AcroFields acroFields = pdfReader.getAcroFields(); HashMap<String,AcroFields.Item> fields = acroFields.getFields(); Set<Entry<String, Item>> entrySet = fields.entrySet(); for (Entry<String, Item> entry : entrySet) { String key = entry.getKey(); } } 
+8
source

Source: https://habr.com/ru/post/1313515/


All Articles