use of com.tom_roush.pdfbox.cos.COSBase in project PdfBox-Android by TomRoush.
the class PDSeedValueCertificate method removeOID.
/**
* removes an OID from the list
*
* @param oid the object identifier to be removed.
*/
public void removeOID(byte[] oid) {
COSBase base = this.dictionary.getDictionaryObject(COSName.OID);
if (base instanceof COSArray) {
COSArray array = (COSArray) base;
array.remove(new COSString(oid));
}
}
use of com.tom_roush.pdfbox.cos.COSBase in project PdfBox-Android by TomRoush.
the class PDSeedValueCertificate method addIssuer.
/**
* array of bytes containing DER-encoded X.509v3 certificates of acceptable issuers. If the
* signer’s certificate chains up to any of the specified issuers (either directly or
* indirectly), the certificate is considered acceptable for signing.
*
* @param issuer A byte array containing DER-encoded X.509v3 certificate
*/
public void addIssuer(byte[] issuer) {
COSBase base = this.dictionary.getDictionaryObject(COSName.ISSUER);
COSArray array;
if (base instanceof COSArray) {
array = (COSArray) base;
} else {
array = new COSArray();
}
COSString string = new COSString(issuer);
array.add(string);
this.dictionary.setItem(COSName.ISSUER, array);
}
use of com.tom_roush.pdfbox.cos.COSBase in project PdfBox-Android by TomRoush.
the class PDSeedValueCertificate method removeIssuer.
/**
* Removes an issuer from the issuers list
*
* @param issuer A byte array containing DER-encoded X.509v3 certificate
*/
public void removeIssuer(byte[] issuer) {
COSBase base = this.dictionary.getDictionaryObject(COSName.ISSUER);
if (base instanceof COSArray) {
COSArray array = (COSArray) base;
array.remove(new COSString(issuer));
}
}
use of com.tom_roush.pdfbox.cos.COSBase in project PdfBox-Android by TomRoush.
the class Filter method getDecodeParams.
// gets the decode params for a specific filter index, this is used to
// normalise the DecodeParams entry so that it is always a dictionary
protected COSDictionary getDecodeParams(COSDictionary dictionary, int index) {
COSBase filter = dictionary.getDictionaryObject(COSName.FILTER, COSName.F);
COSBase obj = dictionary.getDictionaryObject(COSName.DECODE_PARMS, COSName.DP);
if (filter instanceof COSName && obj instanceof COSDictionary) {
// but tests show that Adobe means "one filter name object".
return (COSDictionary) obj;
} else if (filter instanceof COSArray && obj instanceof COSArray) {
COSArray array = (COSArray) obj;
if (index < array.size()) {
COSBase objAtIndex = array.getObject(index);
if (objAtIndex instanceof COSDictionary) {
return (COSDictionary) array.getObject(index);
}
}
} else if (obj != null && !(filter instanceof COSArray || obj instanceof COSArray)) {
Log.e("PdfBox-Android", "Expected DecodeParams to be an Array or Dictionary but found " + obj.getClass().getName());
}
return new COSDictionary();
}
use of com.tom_roush.pdfbox.cos.COSBase in project PdfBox-Android by TomRoush.
the class MoveText method process.
@Override
public void process(Operator operator, List<COSBase> arguments) throws MissingOperandException {
if (arguments.size() < 2) {
throw new MissingOperandException(operator, arguments);
}
Matrix textLineMatrix = context.getTextLineMatrix();
if (textLineMatrix == null) {
Log.w("PdfBox-Android", "TextLineMatrix is null, " + getName() + " operator will be ignored");
return;
}
COSBase base0 = arguments.get(0);
COSBase base1 = arguments.get(1);
if (!(base0 instanceof COSNumber)) {
return;
}
if (!(base1 instanceof COSNumber)) {
return;
}
COSNumber x = (COSNumber) base0;
COSNumber y = (COSNumber) base1;
Matrix matrix = new Matrix(1, 0, 0, 1, x.floatValue(), y.floatValue());
textLineMatrix.concatenate(matrix);
context.setTextMatrix(textLineMatrix.clone());
}
Aggregations