Package org.apache.pdfbox.preflight

Examples of org.apache.pdfbox.preflight.PreflightConfiguration


    private static void callValidation(PreflightContext context, Object element, String processName)
    throws ValidationException
    {
        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


                     */
                    PDColorSpace pdCS = (PDColorSpace) this.getColorSpaces().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 = (PDColorSpace) this.getColorSpaces().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

            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

        }
        else
        {
            try
            {
                PreflightConfiguration config = context.getConfig();
                ColorSpaceHelperFactory csFact = config.getColorSpaceHelperFact();
                PDColorSpace pdCS = PDColorSpaceFactory.createColorSpace(csImg);
                ColorSpaceHelper csh = csFact.getColorSpaceHelper(context, pdCS, ColorSpaceRestriction.NO_PATTERN);
                csh.validate();
            }
            catch (IOException e)
View Full Code Here

        {
            COSDictionary actionsDict = (COSDictionary) vPath.peek();
            // AA entry is authorized only for Page, in this case A Page is just before the Action Dictionary in the path
            boolean aaEntryAuth = ((vPath.size() - vPath.getClosestTypePosition(PDPage.class)) == 2);

            PreflightConfiguration config = context.getConfig();
            ActionManagerFactory factory = config.getActionFact();
            List<AbstractActionManager> la = factory.getActionManagers(context, actionsDict);
            for (AbstractActionManager aMng : la)
            {
                aMng.valid(aaEntryAuth);
            }
View Full Code Here

        if (resources != null)
        {
            Map<String, PDColorSpace> colorSpaces = resources.getColorSpaces();
            if (colorSpaces != null)
            {
                PreflightConfiguration config = context.getConfig();
                ColorSpaceHelperFactory colorSpaceFactory = config.getColorSpaceHelperFact();
                for (PDColorSpace pdCS : colorSpaces.values())
                {
                    ColorSpaceHelper csHelper = colorSpaceFactory.getColorSpaceHelper(context, pdCS,
                            ColorSpaceRestriction.NO_RESTRICTION);
                    csHelper.validate();
View Full Code Here

{

    @Test(expected = MissingValidationProcessException.class)
    public void testGetValidationProcess_MissingProcess() throws Exception
    {
        PreflightConfiguration configuration = PreflightConfiguration.createPdfA1BConfiguration();
        configuration.getInstanceOfProcess("unknownProcess");
    }
View Full Code Here

    }

    @Test
    public void testGetValidationProcess_MissingProcess_NoError() throws Exception
    {
        PreflightConfiguration configuration = PreflightConfiguration.createPdfA1BConfiguration();
        configuration.setErrorOnMissingProcess(false);
        configuration.getInstanceOfProcess("unknownProcess");
    }
View Full Code Here

    }

    @Test
    public void testReplaceValidationProcess() throws Exception
    {
        PreflightConfiguration configuration = PreflightConfiguration.createPdfA1BConfiguration();

        String processName = "mock-process";
        configuration.replaceProcess(processName, MockProcess.class);
        assertEquals(MockProcess.class, configuration.getInstanceOfProcess(processName).getClass());

        configuration.replaceProcess(processName, MockProcess2.class);
        assertEquals(MockProcess2.class, configuration.getInstanceOfProcess(processName).getClass());
    }
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.