Search in sources :

Example 6 with TextType

use of org.apache.xmpbox.type.TextType in project pdfbox by apache.

the class PhotoshopSchema method setICCProfile.

public void setICCProfile(String text) {
    TextType tt = (TextType) instanciateSimple(ICC_PROFILE, text);
    setICCProfileProperty(tt);
}
Also used : TextType(org.apache.xmpbox.type.TextType)

Example 7 with TextType

use of org.apache.xmpbox.type.TextType in project pdfbox by apache.

the class PhotoshopSchema method setCredit.

public void setCredit(String text) {
    TextType tt = (TextType) instanciateSimple(CREDIT, text);
    setCreditProperty(tt);
}
Also used : TextType(org.apache.xmpbox.type.TextType)

Example 8 with TextType

use of org.apache.xmpbox.type.TextType in project pdfbox by apache.

the class XMPBasicSchema method setNickname.

/**
 * Set a short informal name for the resource
 *
 * @param text
 *            the Nickname value to set
 */
public void setNickname(String text) {
    TextType tt = (TextType) instanciateSimple(NICKNAME, text);
    setNicknameProperty(tt);
}
Also used : TextType(org.apache.xmpbox.type.TextType)

Example 9 with TextType

use of org.apache.xmpbox.type.TextType in project pdfbox by apache.

the class XMPMediaManagementSchema method setVersionID.

/**
 * Set VersionId value
 *
 * @param value
 *            VersionId value to set
 */
public void setVersionID(String value) {
    TextType tt = (TextType) instanciateSimple(VERSIONID, value);
    setVersionIDProperty(tt);
}
Also used : TextType(org.apache.xmpbox.type.TextType)

Example 10 with TextType

use of org.apache.xmpbox.type.TextType in project pdfbox by apache.

the class XMPSchema method setUnqualifiedLanguagePropertyValue.

/**
 * Set the value of a multi-lingual property.
 *
 * @param name
 *            The name of the property, it must include the namespace prefix, e.g. "pdf:Keywords"
 * @param language
 *            The language code of the value. If null then "x-default" is assumed.
 * @param value
 *            The value of the property in the specified language.
 */
public void setUnqualifiedLanguagePropertyValue(String name, String language, String value) {
    if (language == null || language.isEmpty()) {
        language = XmpConstants.X_DEFAULT;
    }
    AbstractField property = getAbstractProperty(name);
    ArrayProperty arrayProp;
    if (property != null) {
        // Analyzing content of property
        if (property instanceof ArrayProperty) {
            arrayProp = (ArrayProperty) property;
            // Try to find a definition
            for (AbstractField child : arrayProp.getContainer().getAllProperties()) {
                // try to find the same lang definition
                if (child.getAttribute(XmpConstants.LANG_NAME).getValue().equals(language)) {
                    // the same language has been found
                    arrayProp.getContainer().removeProperty(child);
                    if (value != null) {
                        TextType langValue = createTextType(XmpConstants.LIST_NAME, value);
                        langValue.setAttribute(new Attribute(XMLConstants.XML_NS_URI, XmpConstants.LANG_NAME, language));
                        arrayProp.getContainer().addProperty(langValue);
                    }
                    reorganizeAltOrder(arrayProp.getContainer());
                    return;
                }
            }
            // if no definition found, we add a new one
            TextType langValue = createTextType(XmpConstants.LIST_NAME, value);
            langValue.setAttribute(new Attribute(XMLConstants.XML_NS_URI, XmpConstants.LANG_NAME, language));
            arrayProp.getContainer().addProperty(langValue);
            reorganizeAltOrder(arrayProp.getContainer());
        }
    } else {
        arrayProp = createArrayProperty(name, Cardinality.Alt);
        TextType langValue = createTextType(XmpConstants.LIST_NAME, value);
        langValue.setAttribute(new Attribute(XMLConstants.XML_NS_URI, XmpConstants.LANG_NAME, language));
        arrayProp.getContainer().addProperty(langValue);
        addProperty(arrayProp);
    }
}
Also used : ArrayProperty(org.apache.xmpbox.type.ArrayProperty) AbstractField(org.apache.xmpbox.type.AbstractField) Attribute(org.apache.xmpbox.type.Attribute) TextType(org.apache.xmpbox.type.TextType)

Aggregations

TextType (org.apache.xmpbox.type.TextType)37 AbstractField (org.apache.xmpbox.type.AbstractField)5 ArrayProperty (org.apache.xmpbox.type.ArrayProperty)5 Test (org.junit.Test)4 Method (java.lang.reflect.Method)3 Attribute (org.apache.xmpbox.type.Attribute)3 XMPMetadata (org.apache.xmpbox.XMPMetadata)2 InputStream (java.io.InputStream)1 Calendar (java.util.Calendar)1 ValidationError (org.apache.pdfbox.preflight.ValidationResult.ValidationError)1 DublinCoreSchema (org.apache.xmpbox.schema.DublinCoreSchema)1 BadFieldValueException (org.apache.xmpbox.type.BadFieldValueException)1 BooleanType (org.apache.xmpbox.type.BooleanType)1 DateType (org.apache.xmpbox.type.DateType)1 IntegerType (org.apache.xmpbox.type.IntegerType)1 TypeMapping (org.apache.xmpbox.type.TypeMapping)1 URIType (org.apache.xmpbox.type.URIType)1 URLType (org.apache.xmpbox.type.URLType)1 DomXmpParser (org.apache.xmpbox.xml.DomXmpParser)1