generation/pdf-parameters.js

const _MwWrapper = require("../_mwbridge/_mw-wrapper.js");
const CMYKColor = require("./cmyk-color");

/**
 * PDF parameters wrapper.
 * Expects an underlying `mwObject` instance that provides
 * the corresponding getter/setter methods returning/accepting
 * CMYK strings like "30_100_0_30" or `null`.
 */
class PdfParameters extends _MwWrapper
{
    /**
     * @param {object} mwObject – instance of the Java PdfParameters class
     */
    constructor(mwObject)
    {
        super(mwObject);
        this._mwObject = mwObject;
    }

    /** no-op initializer */
    _initializeWrapperMembers() {}

    /**
     *  CMYK color value of bar code. Null means CMYK color is not used, instead normal RGB color is used.
     *  @returns {CMYKColor|null}
     */
    getCMYKBarColor()
    {
        return CMYKColor.parseCMYK(this.getJavaClass().getCMYKBarColorSync());
    }

    /**
     * CMYK color value of bar code. Null means CMYK color is not used, instead normal RGB color is used.
     * @param {CMYKColor|null} value
     */
    setCMYKBarColor(value)
    {
        this.getJavaClass().setCMYKBarColorSync(value != null ? value.formatCMYK() : null);
    }

    /**
     * CMYK back color value. Null means CMYK color is not used, instead normal RGB color is used.
     * @returns {CMYKColor|null}
     */
    getCMYKBackColor()
    {
        return CMYKColor.parseCMYK(this.getJavaClass().getCMYKBackColorSync());
    }

    /**
     * CMYK back color value. Null means CMYK color is not used, instead normal RGB color is used.
     * @param {CMYKColor|null} value
     */
    setCMYKBackColor(value)
    {
        this.getJavaClass().setCMYKBackColorSync(value != null ? value.formatCMYK() : null);
    }

    /**
     * CMYK color value of Codetext. Null means CMYK color is not used, instead normal RGB color is used.
     * @returns {CMYKColor|null}
     */
    getCMYKCodetextColor()
    {
        return CMYKColor.parseCMYK(this.getJavaClass().getCMYKCodetextColorSync());
    }

    /**
     * CMYK color value of Codetext. Null means CMYK color is not used, instead normal RGB color is used.
     * @param {CMYKColor|null} value
     */
    setCMYKCodetextColor(value)
    {
        this.getJavaClass().setCMYKCodetextColorSync(value != null ? value.formatCMYK() : null);
    }

    /**
     * CMYK color value of caption above. Null means CMYK color is not used, instead normal RGB color is used.
     * @returns {CMYKColor|null}
     */
    getCMYKCaptionAboveColor() {
        return CMYKColor.parseCMYK(this.getJavaClass().getCMYKCaptionAboveColorSync());
    }

    /**
     * CMYK color value of caption above. Null means CMYK color is not used, instead normal RGB color is used.
     *  @param {CMYKColor|null} value
     */
    setCMYKCaptionAboveColor(value) {
        this.getJavaClass().setCMYKCaptionAboveColorSync(value != null ? value.formatCMYK() : null);
    }

    /**
     * CMYK color value of caption below. Null means CMYK color is not used, instead normal RGB color is used.
     * @returns {CMYKColor|null}
     */
    getCMYKCaptionBelowColor()
    {
        return CMYKColor.parseCMYK(this.getJavaClass().getCMYKCaptionBelowColorSync());
    }

    /**
     * CMYK color value of caption below. Null means CMYK color is not used, instead normal RGB color is used.
     * @param {CMYKColor|null} value
     */
    setCMYKCaptionBelowColor(value)
    {
        this.getJavaClass().setCMYKCaptionBelowColorSync(value.formatCMYK());
    }

    /**
     * <p>
     * Are paths used instead of text (use if Unicode characters are not displayed)
     * Default value: false.
     * </p>
     */
    isTextAsPath()
    {
        return this.getJavaClass().isTextAsPathSync();
    }

    /**
     * <p>
     * Are paths used instead of text (use if Unicode characters are not displayed)
     * Default value: false.
     * </p>
     */
    setTextAsPath(value)
    {
        this.getJavaClass().setTextAsPathSync(value);
    }
}

module.exports = PdfParameters;