Package org.apache.pdfbox.pdmodel.graphics.color

Examples of org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace


            {
                colorspaces = new HashMap<String, PDColorSpace>();
                for (COSName csName : csDictionary.keySet())
                {
                    COSBase cs = csDictionary.getDictionaryObject(csName);
                    PDColorSpace colorspace = null;
                    try
                    {
                        colorspace = PDColorSpaceFactory.createColorSpace(cs);
                    }
                    catch (IOException exception)
View Full Code Here


     * @throws IOException If there is an error getting the colorspace.
     */
    public PDColorSpace getColorSpace( Map colorSpaces ) throws IOException
    {
        COSBase cs = getCOSObject( COSName.CS, COSName.COLORSPACE );
        PDColorSpace retval = null;
        if( cs != null )
        {
            retval = PDColorSpaceFactory.createColorSpace( cs, colorSpaces );
        }
        return retval;
View Full Code Here

                    // The color space is unknown. Try to access the resources dictionary,
                    // the color space can be a reference.
                    Map<String, PDColorSpace> colorSpaces = this.getResources().getColorSpaces();
                    if (colorSpaces != null)
                    {
                        PDColorSpace pdCS = colorSpaces.get(colorSpace);
                        if (pdCS != null)
                        {
                            cs = ColorSpaces.valueOf(pdCS.getName());
                            PreflightConfiguration cfg = context.getConfig();
                            ColorSpaceHelperFactory csFact = cfg.getColorSpaceHelperFact();
                            csHelper = csFact.getColorSpaceHelper(context, pdCS, ColorSpaceRestriction.ONLY_DEVICE);
                        }
                    }
                }

                if (cs == null)
                {
                    registerError("The ColorSpace is unknown", ERROR_GRAPHIC_UNEXPECTED_VALUE_FOR_KEY);
                    return;
                }
            }

            if (csHelper == null)
            {
                PDColorSpace pdCS = PDColorSpaceFactory.createColorSpace(csInlinedBase);
                PreflightConfiguration cfg = context.getConfig();
                ColorSpaceHelperFactory csFact = cfg.getColorSpaceHelperFact();
                csHelper = csFact.getColorSpaceHelper(context, pdCS, ColorSpaceRestriction.ONLY_DEVICE);
            }
View Full Code Here

        {
            result = validColorSpaceDestOutputProfile(expectedType);
        }
        else
        {
            PDColorSpace cs = colorState.getColorSpace();
            if (isDeviceIndependent(cs, expectedType))
            {
                result = true;
            }
            else
View Full Code Here

             * The color space is unknown. Try to access the resources dictionary, the color space can be a reference.
             */
            Map<String, PDColorSpace> colorSpaces = this.getResources().getColorSpaces();
            if (colorSpaces != null)
            {
                PDColorSpace pdCS = colorSpaces.get(colorSpaceName);
                if (pdCS != null)
                {
                    cs = ColorSpaces.valueOf(pdCS.getName());
                    PreflightConfiguration cfg = context.getConfig();
                    ColorSpaceHelperFactory csFact = cfg.getColorSpaceHelperFact();
                    csHelper = csFact.getColorSpaceHelper(context, pdCS, ColorSpaceRestriction.NO_RESTRICTION);
                }
            }
        }

        if (cs == null)
        {
            registerError("The ColorSpace is unknown", ERROR_GRAPHIC_UNEXPECTED_VALUE_FOR_KEY);
            return;
        }

        if (csHelper == null)
        {
            PDColorSpace pdCS = PDColorSpaceFactory.createColorSpace(COSName.getPDFName(colorSpaceName));
            PreflightConfiguration cfg = context.getConfig();
            ColorSpaceHelperFactory csFact = cfg.getColorSpaceHelperFact();
            csHelper = csFact.getColorSpaceHelper(context, pdCS, ColorSpaceRestriction.NO_RESTRICTION);
        }

View Full Code Here

     * @throws IOException If there is an error getting the colorspace.
     */
    public PDColorSpace getColorSpace() throws IOException
    {
        COSBase cs = getCOSStream().getDictionaryObject( COSName.COLORSPACE, COSName.CS );
        PDColorSpace retval = null;
        if( cs != null )
        {
            retval = PDColorSpaceFactory.createColorSpace( cs );
            if (retval == null)
            {
View Full Code Here

            {
                colorspaces = new HashMap<String, PDColorSpace>();
                for (COSName csName : csDictionary.keySet())
                {
                    COSBase cs = csDictionary.getDictionaryObject(csName);
                    PDColorSpace colorspace = null;
                    try
                    {
                        colorspace = PDColorSpaceFactory.createColorSpace(cs);
                    }
                    catch (IOException exception)
View Full Code Here

                context.addValidationError(new ValidationError(ERROR_GRAPHIC_INVALID_COLOR_SPACE_MISSING,
                        "DestOutputProfile is missing"));
                return;
            }

            PDColorSpace altColor = deviceN.getAlternateColorSpace();
            if (altColor != null)
            {
                processAllColorSpace(altColor);
            }
View Full Code Here

    protected void processIndexedColorSpace(PDColorSpace pdcs)
    {
        PDIndexed indexed = (PDIndexed) pdcs;
        try
        {
            PDColorSpace based = indexed.getBaseColorSpace();
            ColorSpaces cs = ColorSpaces.valueOf(based.getName());
            if (cs == ColorSpaces.Indexed || cs == ColorSpaces.Indexed_SHORT)
            {
                context.addValidationError(new ValidationError(ERROR_GRAPHIC_INVALID_COLOR_SPACE_INDEXED,
                        "Indexed color space can't be used as Base color space"));
                return;
View Full Code Here

    {
        PDSeparation separation = (PDSeparation) pdcs;
        try
        {

            PDColorSpace altCol = separation.getAlternateColorSpace();
            if (altCol != null)
            {
                ColorSpaces acs = ColorSpaces.valueOf(altCol.getName());
                switch (acs)
                {
                case Separation:
                case DeviceN:
                case Pattern:
View Full Code Here

TOP

Related Classes of org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.