use of com.tom_roush.pdfbox.pdmodel.interactive.annotation.PDAppearanceDictionary in project PdfBox-Android by TomRoush.
the class PDAbstractAppearanceHandler method getDownAppearance.
/**
* Get the annotations down appearance.
*
* <p>
* This will get the annotations down appearance. If this is not existent an
* empty appearance entry will be created.
*
* @return the appearance entry representing the down appearance.
*/
PDAppearanceEntry getDownAppearance() {
PDAppearanceDictionary appearanceDictionary = getAppearance();
PDAppearanceEntry downAppearanceEntry = appearanceDictionary.getDownAppearance();
if (downAppearanceEntry.isSubDictionary()) {
downAppearanceEntry = new PDAppearanceEntry(createCOSStream());
appearanceDictionary.setDownAppearance(downAppearanceEntry);
}
return downAppearanceEntry;
}
use of com.tom_roush.pdfbox.pdmodel.interactive.annotation.PDAppearanceDictionary in project PdfBox-Android by TomRoush.
the class PDAbstractAppearanceHandler method getAppearance.
/**
* Get the annotations appearance dictionary.
*
* <p>
* This will get the annotations appearance dictionary. If this is not
* existent an empty appearance dictionary will be created.
*
* @return the annotations appearance dictionary
*/
PDAppearanceDictionary getAppearance() {
PDAppearanceDictionary appearanceDictionary = annotation.getAppearance();
if (appearanceDictionary == null) {
appearanceDictionary = new PDAppearanceDictionary();
annotation.setAppearance(appearanceDictionary);
}
return appearanceDictionary;
}
use of com.tom_roush.pdfbox.pdmodel.interactive.annotation.PDAppearanceDictionary in project PdfBox-Android by TomRoush.
the class PDAbstractAppearanceHandler method getNormalAppearance.
/**
* Get the annotations normal appearance.
*
* <p>
* This will get the annotations normal appearance. If this is not existent
* an empty appearance entry will be created.
*
* @return the appearance entry representing the normal appearance.
*/
private PDAppearanceEntry getNormalAppearance() {
PDAppearanceDictionary appearanceDictionary = getAppearance();
PDAppearanceEntry normalAppearanceEntry = appearanceDictionary.getNormalAppearance();
if (normalAppearanceEntry == null || normalAppearanceEntry.isSubDictionary()) {
normalAppearanceEntry = new PDAppearanceEntry(createCOSStream());
appearanceDictionary.setNormalAppearance(normalAppearanceEntry);
}
return normalAppearanceEntry;
}
use of com.tom_roush.pdfbox.pdmodel.interactive.annotation.PDAppearanceDictionary in project PdfBox-Android by TomRoush.
the class FDFField method getAppearanceDictionary.
/**
* This will get the appearance dictionary that specifies the appearance of a pushbutton field.
*
* @return The AP entry of this dictionary.
*/
public PDAppearanceDictionary getAppearanceDictionary() {
PDAppearanceDictionary retval = null;
COSDictionary dict = (COSDictionary) field.getDictionaryObject(COSName.AP);
if (dict != null) {
retval = new PDAppearanceDictionary(dict);
}
return retval;
}
use of com.tom_roush.pdfbox.pdmodel.interactive.annotation.PDAppearanceDictionary in project PdfBox-Android by TomRoush.
the class PageDrawer method showAnnotation.
@Override
public void showAnnotation(PDAnnotation annotation) throws IOException {
lastClip = null;
// Device checks shouldn't be needed
if (annotation.isNoView()) {
return;
}
if (annotation.isHidden()) {
return;
}
if (annotation.isInvisible() && annotation instanceof PDAnnotationUnknown) {
// of the standard annotation types and no annotation handler is available."
return;
}
if (isHiddenOCG(annotation.getOptionalContent())) {
return;
}
PDAppearanceDictionary appearance = annotation.getAppearance();
if (appearance == null || appearance.getNormalAppearance() == null) {
annotation.constructAppearances(renderer.document);
}
if (annotation.isNoRotate() && getCurrentPage().getRotation() != 0) {
PDRectangle rect = annotation.getRectangle();
android.graphics.Matrix savedTransform = canvas.getMatrix();
// "The upper-left corner of the annotation remains at the same point in
// default user space; the annotation pivots around that point."
canvas.rotate(getCurrentPage().getRotation(), rect.getLowerLeftX(), rect.getUpperRightY());
super.showAnnotation(annotation);
canvas.setMatrix(savedTransform);
} else {
super.showAnnotation(annotation);
}
}
Aggregations