File filePDF = new File(PDF_FREEDOM);
File fileFDF = new File(FDF_FREEDOM);
if (filePDF.exists() && fileFDF.exists())
{
PDDocument freedom = null;
FDFDocument fdf = null;
try
{
freedom = PDDocument.load( filePDF );
fdf = FDFDocument.load( fileFDF );
PDAcroForm form = freedom.getDocumentCatalog().getAcroForm();
form.importFDF( fdf );
PDTextField feld2 = (PDTextField)form.getField( "eeFirstName" );
List<COSObjectable> kids = feld2.getKids();
PDFieldTreeNode firstKid = (PDFieldTreeNode)kids.get( 0 );
PDFieldTreeNode secondKid = (PDFieldTreeNode)kids.get( 1 );
testContentStreamContains( freedom, firstKid, "Steve" );
testContentStreamContains( freedom, secondKid, "Steve" );
//the appearance stream is suppose to be null because there
//is an F action in the AA dictionary that populates that field.
PDFieldTreeNode totalAmt = form.getField( "eeSuppTotalAmt" );
assertTrue( totalAmt.getDictionary().getDictionaryObject( COSName.AP ) == null );
}
finally
{
if( freedom != null )
{
freedom.close();
}
if( fdf != null )
{
fdf.close();
}
}
}
}