Openpdf: Help to get the value of Item Object

Created on 12 Dec 2019  路  2Comments  路  Source: LibrePDF/OpenPDF

Before i used to get the value like that :

AcroFields fields = pdf.getAcroFields();
Set<String> fldNames = (Set) fields.getFields().keySet();
for (String fldName : fldNames) 
    logger.debug(fldName + " : " + fields.getField(fldName));

But now getFields is deprecated so I wanted to go like :

AcroFields fields = pdf.getAcroFields();
Map<String, AcroFields.Item> fldItems = fields.getAllFields();
fldItems.forEach((key, value) -> {
    logger.debug(key + " : " + value.toString());
});

But that print the memory adress of the Item Object.

It is the good way to handle this ?

question

Most helpful comment

getAllFields return exactly the same map as getFields does, merely the announced type differs. Thus, you can simply replace getFields by getAllFields in your original code and be done with this deprecation.

All 2 comments

getAllFields return exactly the same map as getFields does, merely the announced type differs. Thus, you can simply replace getFields by getAllFields in your original code and be done with this deprecation.

Thanks that working.

Maybe give the possibility to get the value field from the Map ??

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bberto picture bberto  路  7Comments

mattymurphy picture mattymurphy  路  3Comments

sjalouali picture sjalouali  路  3Comments

razilein picture razilein  路  6Comments

michaelhugi picture michaelhugi  路  6Comments