public ASAtom getName() { return this.base != null ? this.base.getName() : null; }
/** * Gets encoding object from COSObject. * * @param e is value of Encoding key in font dictionary. * @return encoding object for given COSObject. */ private static Encoding getEncodingMappingFromCOSObject(COSObject e) { Encoding encodingObj; COSBase cosEncoding = e.getDirectBase(); if (cosEncoding != null) { if (cosEncoding.getType() == COSObjType.COS_NAME) { encodingObj = new Encoding(cosEncoding.getName()); return encodingObj; } else if (cosEncoding.getType() == COSObjType.COS_DICT) { encodingObj = new Encoding(cosEncoding.getNameKey(ASAtom.BASE_ENCODING), getDifferencesFromCosEncoding(e)); return encodingObj; } } return null; }
private static boolean isMarkedContentAFKeyAndValueTypeCorrect(COSBase tag, COSBase propKey) { if (tag == null || propKey == null) { return false; } else if (tag.getType() != COSObjType.COS_NAME || propKey.getType() != COSObjType.COS_NAME) { return false; } else if (ASAtom.AF != tag.getName()) { return false; } return true; }
private void initializePropertiesDict(PDResourcesHandler resources) { if (!this.arguments.isEmpty()) { COSBase lastArg = this.arguments.get(this.arguments.size() - 1); COSObjType lastArgType = lastArg.getType(); if (lastArgType == COSObjType.COS_DICT) { this.propertiesDict = (COSDictionary) lastArg; } else if (lastArgType == COSObjType.COS_NAME && resources != null) { PDResource properties = resources.getProperties(lastArg.getName()); if (properties != null) { COSBase cosProperties = properties.getObject().getDirectBase(); if (cosProperties != null && cosProperties.getType() == COSObjType.COS_DICT) { this.propertiesDict = (COSDictionary) cosProperties; } } } } }
private static void checkAFKey(List<COSBase> arguments, PDResourcesHandler resourcesHandler) { int argumentsSize = arguments.size(); if (argumentsSize > 1) { COSBase tag = arguments.get(argumentsSize - 2); COSBase propKey = arguments.get(argumentsSize - 1); if (isMarkedContentAFKeyAndValueTypeCorrect(tag, propKey)) { PDResource properties = resourcesHandler.getProperties(propKey.getName()); if (properties != null) { COSObject cosProperties = properties.getObject(); if (cosProperties != null && cosProperties.getType() == COSObjType.COS_ARRAY) { FileSpecificationKeysHelper.registerFileSpecificationKeys((COSArray) cosProperties.getDirectBase()); } } } } }