Package org.apache.pdfbox.preflight

Examples of org.apache.pdfbox.preflight.PreflightConfiguration


        }
        else
        {
            COSDictionary annotDict = (COSDictionary) vPath.peek();

            PreflightConfiguration config = context.getConfig();
            AnnotationValidatorFactory factory = config.getAnnotFact();
            AnnotationValidator annotValidator = factory.getAnnotationValidator(context, annotDict);
            if (annotValidator != null)
            {
                annotValidator.validate();
            }
View Full Code Here


                    {
                        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);
            }

            csHelper.validate();
        }
View Full Code Here

            {
                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);
        }

        csHelper.validate();
    }
View Full Code Here

                 * checked even if the OutputConditionIdentifier isn't "Custom"
                 */
                COSBase destOutputProfile = outputIntentDict.getItem(OUTPUT_INTENT_DICTIONARY_KEY_DEST_OUTPUT_PROFILE);
                validateICCProfile(destOutputProfile, tmpDestOutputProfile, ctx);

                PreflightConfiguration config = ctx.getConfig();
                if (config.isLazyValidation() && !isStandardICCCharacterization(outputConditionIdentifier))
                {
                    String info = outputIntentDict.getString(COSName.getPDFName(OUTPUT_INTENT_DICTIONARY_KEY_INFO));
                    if (info == null || "".equals(info))
                    {
                        ValidationError error = new ValidationError(ERROR_GRAPHIC_OUTPUT_INTENT_INVALID_ENTRY,
View Full Code Here

                        "OutputIntent object uses a NULL Object"));
                return;
            }

            ICC_Profile iccp = ICC_Profile.getInstance(stream.getByteArray());
            PreflightConfiguration config = ctx.getConfig();
            // check the ICC Profile version (6.2.2)
            if (iccp.getMajorVersion() == 2)
            {
                if (iccp.getMinorVersion() > 0x40)
                {
                    // in PDF 1.4, max version is 02h.40h (meaning V 3.5)
                    // see the ICCProfile specification (ICC.1:1998-09)page 13 - §6.1.3 :
                    // The current profile version number is "2.4.0" (encoded as 02400000h")
                    ValidationError error = new ValidationError(ERROR_GRAPHIC_OUTPUT_INTENT_ICC_PROFILE_TOO_RECENT,
                            "Invalid version of the ICCProfile");
                    error.setWarning(config.isLazyValidation());
                    addValidationError(ctx, error);
                    return;
                } // else OK
            }
            else if (iccp.getMajorVersion() > 2)
            {
                // in PDF 1.4, max version is 02h.40h (meaning V 3.5)
                // see the ICCProfile specification (ICC.1:1998-09)page 13 - §6.1.3 :
                // The current profile version number is "2.4.0" (encoded as 02400000h"
                ValidationError error = new ValidationError(ERROR_GRAPHIC_OUTPUT_INTENT_ICC_PROFILE_TOO_RECENT,
                        "Invalid version of the ICCProfile");
                error.setWarning(config.isLazyValidation());
                addValidationError(ctx, error);
                return;
            } // else seems less than 2, so correct

            if (ctx.getIccProfileWrapper() == null)
View Full Code Here

                 * checked even if the OutputConditionIdentifier isn't "Custom"
                 */
                COSBase destOutputProfile = outputIntentDict.getItem(OUTPUT_INTENT_DICTIONARY_KEY_DEST_OUTPUT_PROFILE);
                validateICCProfile(destOutputProfile, tmpDestOutputProfile, ctx);

                PreflightConfiguration config = ctx.getConfig();
                if (config.isLazyValidation() && !isStandardICCCharacterization(outputConditionIdentifier))
                {
                    String info = outputIntentDict.getString(COSName.getPDFName(OUTPUT_INTENT_DICTIONARY_KEY_INFO));
                    if (info == null || "".equals(info))
                    {
                        ValidationError error = new ValidationError(ERROR_GRAPHIC_OUTPUT_INTENT_INVALID_ENTRY,
View Full Code Here

                        "OutputIntent object uses a NULL Object"));
                return;
            }

            ICC_Profile iccp = ICC_Profile.getInstance(stream.getByteArray());
            PreflightConfiguration config = ctx.getConfig();
            // check the ICC Profile version (6.2.2)
            if (iccp.getMajorVersion() == 2)
            {
                if (iccp.getMinorVersion() > 0x40)
                {
                    // in PDF 1.4, max version is 02h.40h (meaning V 3.5)
                    // see the ICCProfile specification (ICC.1:1998-09)page 13 - §6.1.3 :
                    // The current profile version number is "2.4.0" (encoded as 02400000h")
                    ValidationError error = new ValidationError(ERROR_GRAPHIC_OUTPUT_INTENT_ICC_PROFILE_TOO_RECENT,
                            "Invalid version of the ICCProfile");
                    error.setWarning(config.isLazyValidation());
                    addValidationError(ctx, error);
                    return;
                } // else OK
            }
            else if (iccp.getMajorVersion() > 2)
            {
                // in PDF 1.4, max version is 02h.40h (meaning V 3.5)
                // see the ICCProfile specification (ICC.1:1998-09)page 13 - §6.1.3 :
                // The current profile version number is "2.4.0" (encoded as 02400000h"
                ValidationError error = new ValidationError(ERROR_GRAPHIC_OUTPUT_INTENT_ICC_PROFILE_TOO_RECENT,
                        "Invalid version of the ICCProfile");
                error.setWarning(config.isLazyValidation());
                addValidationError(ctx, error);
                return;
            } // else seems less than 2, so correct

            if (ctx.getIccProfileWrapper() == null)
View Full Code Here

            throw new ValidationException("Unable to process an element without context.");
        }

        PreflightPath validationPath = context.getValidationPath();
        boolean needPop = validationPath.pushObject(element);
        PreflightConfiguration config = context.getConfig();
        ValidationProcess process = config.getInstanceOfProcess(processName);
        process.validate(context);
        if (needPop)
            validationPath.pop();
    }
View Full Code Here

            throw new ValidationException("Annotation validation process needs at least one COSDictionary object");
        }

        COSDictionary annotDict = (COSDictionary) vPath.peek();

        PreflightConfiguration config = context.getConfig();
        AnnotationValidatorFactory factory = config.getAnnotFact();
        AnnotationValidator annotValidator = factory.getAnnotationValidator(context, annotDict);
        if (annotValidator != null)
        {
            annotValidator.validate();
        }
View Full Code Here

            throws ValidationException
    {
        try
        {
            PDColorSpace pColorSpace = shadingRes.getColorSpace();
            PreflightConfiguration config = context.getConfig();
            ColorSpaceHelperFactory csFact = config.getColorSpaceHelperFact();
            ColorSpaceHelper csh = csFact.getColorSpaceHelper(context, pColorSpace, ColorSpaceRestriction.NO_PATTERN);
            csh.validate();
        }
        catch (IOException e)
        {
View Full Code Here

TOP

Related Classes of org.apache.pdfbox.preflight.PreflightConfiguration

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.