use of com.tom_roush.pdfbox.cos.COSBase in project PdfBox-Android by TomRoush.
the class PDActionGoTo method setDestination.
/**
* This will set the destination to jump to.
*
* @param d The destination.
*
* @throws IllegalArgumentException if the destination is not a page dictionary object.
*/
public void setDestination(PDDestination d) {
if (d instanceof PDPageDestination) {
PDPageDestination pageDest = (PDPageDestination) d;
COSArray destArray = pageDest.getCOSObject();
if (destArray.size() >= 1) {
COSBase page = destArray.getObject(0);
if (!(page instanceof COSDictionary)) {
throw new IllegalArgumentException("Destination of a GoTo action must be " + "a page dictionary object");
}
}
}
getCOSObject().setItem(COSName.D, d);
}
use of com.tom_roush.pdfbox.cos.COSBase in project PdfBox-Android by TomRoush.
the class PDTilingPattern method getBBox.
/**
* An array of four numbers in the form coordinate system (see
* below), giving the coordinates of the left, bottom, right, and top edges,
* respectively, of the pattern's bounding box.
*
* @return The BBox of the pattern.
*/
@Override
public PDRectangle getBBox() {
PDRectangle retval = null;
COSBase base = getCOSObject().getDictionaryObject(COSName.BBOX);
if (base instanceof COSArray) {
retval = new PDRectangle((COSArray) base);
}
return retval;
}
use of com.tom_roush.pdfbox.cos.COSBase in project PdfBox-Android by TomRoush.
the class PDShading method getColorSpace.
/**
* This will get the color space or null if none exists.
*
* @return the color space for the shading
* @throws IOException if there is an error getting the color space
*/
public PDColorSpace getColorSpace() throws IOException {
if (colorSpace == null) {
COSBase colorSpaceDictionary = dictionary.getDictionaryObject(COSName.CS, COSName.COLORSPACE);
colorSpace = PDColorSpace.create(colorSpaceDictionary);
}
return colorSpace;
}
use of com.tom_roush.pdfbox.cos.COSBase in project PdfBox-Android by TomRoush.
the class PDFontSetting method getFont.
/**
* This will get the font for this font setting.
*
* @return The font for this setting of null if one was not found.
*
* @throws IOException If there is an error getting the font.
*/
public PDFont getFont() throws IOException {
PDFont retval = null;
COSBase font = fontSetting.getObject(0);
if (font instanceof COSDictionary) {
retval = PDFontFactory.createFont((COSDictionary) font);
}
return retval;
}
use of com.tom_roush.pdfbox.cos.COSBase in project PdfBox-Android by TomRoush.
the class PDButton method getExportValues.
/**
* This will get the (optional) export values.
*
* <p>The export values are defined in the field dictionaries /Opt key.</p>
*
* <p>The option values are used to define the export values
* for the field to
* <ul>
* <li>hold values in non-Latin writing systems as name objects, which represent the field value, are limited
* to PDFDocEncoding
* </li>
* <li>allow radio buttons having the same export value to be handled independently
* </li>
* </ul>
*
* @return List containing all possible export values. If there is no /Opt entry an empty list will be returned.
*
* @see #getOnValues()
*/
public List<String> getExportValues() {
COSBase value = getInheritableAttribute(COSName.OPT);
if (value instanceof COSString) {
List<String> array = new ArrayList<String>();
array.add(((COSString) value).getString());
return array;
} else if (value instanceof COSArray) {
return COSArrayList.convertCOSStringCOSArrayToList((COSArray) value);
}
return Collections.emptyList();
}
Aggregations