This class represents a PDF /AP entry the appearance dictionary.
Method from org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceDictionary Detail: |
public COSBase getCOSObject() {
return dictionary;
}
|
public COSDictionary getDictionary() {
return dictionary;
}
|
public Map getDownAppearance() {
Map retval = null;
COSBase ap = dictionary.getDictionaryObject( COSName.getPDFName( "D" ) );
if( ap == null )
{
retval = getNormalAppearance();
}
else
{
if( ap instanceof COSStream )
{
COSStream aux = (COSStream) ap;
ap = new COSDictionary();
((COSDictionary)ap).setItem(COSName.getPDFName( "default" ), aux );
}
COSDictionary map = (COSDictionary)ap;
Map< String, PDAppearanceStream > actuals =
new HashMap< String, PDAppearanceStream >();
retval = new COSDictionaryMap( actuals, map );
for( COSName asName : map.keySet() )
{
COSStream as = (COSStream)map.getDictionaryObject( asName );
actuals.put( asName.getName(), new PDAppearanceStream( as ) );
}
}
return retval;
}
This will return a list of appearances. In the case where there is
only one appearance the map will contain one entry whose key is the string
"default". If there is no rollover appearance then the normal appearance
will be returned. Which means that this method will never return null. |
public Map getNormalAppearance() {
COSBase ap = dictionary.getDictionaryObject( COSName.getPDFName( "N" ) );
if( ap instanceof COSStream )
{
COSStream aux = (COSStream) ap;
ap = new COSDictionary();
((COSDictionary)ap).setItem(COSName.getPDFName( "default" ), aux );
}
COSDictionary map = (COSDictionary)ap;
Map< String, PDAppearanceStream > actuals = new HashMap< String, PDAppearanceStream >();
Map retval = new COSDictionaryMap( actuals, map );
for( COSName asName : map.keySet() )
{
COSStream as = (COSStream)map.getDictionaryObject( asName );
actuals.put( asName.getName(), new PDAppearanceStream( as ) );
}
return retval;
}
This will return a list of appearances. In the case where there is
only one appearance the map will contain one entry whose key is the string
"default". |
public Map getRolloverAppearance() {
Map retval = null;
COSBase ap = dictionary.getDictionaryObject( COSName.getPDFName( "R" ) );
if( ap == null )
{
retval = getNormalAppearance();
}
else
{
if( ap instanceof COSStream )
{
COSStream aux = (COSStream) ap;
ap = new COSDictionary();
((COSDictionary)ap).setItem(COSName.getPDFName( "default" ), aux );
}
COSDictionary map = (COSDictionary)ap;
Map< String, PDAppearanceStream > actuals = new HashMap< String, PDAppearanceStream >();
retval = new COSDictionaryMap( actuals, map );
for( COSName asName : map.keySet() )
{
COSStream as = (COSStream)map.getDictionaryObject( asName );
actuals.put( asName.getName(), new PDAppearanceStream( as ) );
}
}
return retval;
}
This will return a list of appearances. In the case where there is
only one appearance the map will contain one entry whose key is the string
"default". If there is no rollover appearance then the normal appearance
will be returned. Which means that this method will never return null. |
public void setDownAppearance(Map appearanceMap) {
dictionary.setItem( COSName.getPDFName( "D" ), COSDictionaryMap.convert( appearanceMap ) );
}
This will set a list of appearances. If you would like to set the single
appearance then you should use the key "default", and when the PDF is written
back to the filesystem then there will only be one stream. |
public void setNormalAppearance(Map appearanceMap) {
dictionary.setItem( COSName.getPDFName( "N" ), COSDictionaryMap.convert( appearanceMap ) );
}
This will set a list of appearances. If you would like to set the single
appearance then you should use the key "default", and when the PDF is written
back to the filesystem then there will only be one stream. |
public void setNormalAppearance(PDAppearanceStream ap) {
dictionary.setItem( COSName.getPDFName( "N" ), ap.getStream() );
}
This will set the normal appearance when there is only one appearance
to be shown. |
public void setRolloverAppearance(Map appearanceMap) {
dictionary.setItem( COSName.getPDFName( "R" ), COSDictionaryMap.convert( appearanceMap ) );
}
This will set a list of appearances. If you would like to set the single
appearance then you should use the key "default", and when the PDF is written
back to the filesystem then there will only be one stream. |