Package org.apache.pdfbox.preflight

Examples of org.apache.pdfbox.preflight.PreflightPath


public class ExtGStateValidationProcess extends AbstractProcess
{

    public void validate(PreflightContext context) throws ValidationException
    {
        PreflightPath vPath = context.getValidationPath();
        if (vPath.isEmpty() || !vPath.isExpectedType(COSDictionary.class))
        {
            throw new ValidationException("ExtGState validation required at least a Resource dictionary");
        }

        COSDictionary extGStatesDict = (COSDictionary) vPath.peek();
        List<COSDictionary> listOfExtGState = extractExtGStateDictionaries(context, extGStatesDict);
        validateTransparencyRules(context, listOfExtGState);
    }
View Full Code Here


public class AnnotationValidationProcess extends AbstractProcess
{

    public void validate(PreflightContext context) throws ValidationException
    {
        PreflightPath vPath = context.getValidationPath();
        if (vPath.isEmpty() || !vPath.isExpectedType(COSDictionary.class))
        {
            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)
View Full Code Here

     * An Form XObject is a ContentStream. This method method uses an instance of ContentStreamWrapper to check the
     * Stream of this Form XObject.
     */
    protected void validateXObjectContent() throws ValidationException
    {
        PreflightPath vPath = context.getValidationPath();
        ContentStreamWrapper csWrapper = new ContentStreamWrapper(context, vPath.getClosestPathElement(PDPage.class));
        csWrapper.validXObjContentStream(pdXObj);
    }
View Full Code Here

public class ShaddingPatternValidationProcess extends AbstractProcess
{

    public void validate(PreflightContext context) throws ValidationException
    {
        PreflightPath vPath = context.getValidationPath();
        if (vPath.isEmpty() && !vPath.isExpectedType(PDResources.class))
        {
            throw new ValidationException("ShadingPattern validation required at least a PDResources");
        }

        PDShadingResources shaddingResource = (PDShadingResources) vPath.peek();
        PDPage page = vPath.getClosestPathElement(PDPage.class);
        checkColorSpace(context, page, shaddingResource);
        checkGraphicState(context, page, shaddingResource);
    }
View Full Code Here

public class ActionsValidationProcess extends AbstractProcess
{

    public void validate(PreflightContext context) throws ValidationException
    {
        PreflightPath vPath = context.getValidationPath();
        if (vPath.isEmpty() || !vPath.isExpectedType(COSDictionary.class))
        {
            throw new ValidationException("Action validation process needs at least one COSDictionary object");
        }

        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)
View Full Code Here

public class SinglePageValidationProcess extends AbstractProcess
{

    public void validate(PreflightContext context) throws ValidationException
    {
        PreflightPath vPath = context.getValidationPath();
        if (vPath.isEmpty() && !vPath.isExpectedType(PDPage.class))
        {
            throw new ValidationException("Page validation required at least a PDPage");
        }

        PDPage page = (PDPage) vPath.peek();
        validateActions(context, page);
        validateAnnotation(context, page);
        validateColorSpaces(context, page);
        validateResources(context, page);
        validateGraphicObjects(context, page);
View Full Code Here

public class TilingPatternValidationProcess extends AbstractProcess
{

    public void validate(PreflightContext context) throws ValidationException
    {
        PreflightPath vPath = context.getValidationPath();
        if (vPath.isEmpty() && !vPath.isExpectedType(PDPage.class))
        {
            throw new ValidationException("Tiling pattern validation required at least a PDPage");
        }

        PDTilingPatternResources tilingPattern = (PDTilingPatternResources) vPath.peek();
        PDPage page = vPath.getClosestPathElement(PDPage.class);

        checkMandatoryFields(context, page, tilingPattern);
        parseResources(context, page, tilingPattern);
        parsePatternContent(context, page, tilingPattern);
    }
View Full Code Here

public class FontValidationProcess extends AbstractProcess
{

    public void validate(PreflightContext context) throws ValidationException
    {
        PreflightPath vPath = context.getValidationPath();
        if (vPath.isEmpty() || !vPath.isExpectedType(PDFont.class))
        {
            throw new ValidationException("Font validation process needs at least one PDFont object");
        }

        PDFont font = (PDFont) vPath.peek();
        FontContainer fontContainer = context.getFontContainer(font.getCOSObject());
        if (fontContainer == null)
        { // if fontContainer isn't null the font is already checked
            FontValidator<? extends FontContainer> validator = getFontValidator(context, font);
            validator.validate();
View Full Code Here

     *
     * @return the width of the character
     */
    private float getWidthFromCharacterStream(PDResources resources, COSStream charStream) throws IOException
    {
        PreflightPath vPath = context.getValidationPath();
        PDFAType3StreamParser parser = new PDFAType3StreamParser(context, vPath.getClosestPathElement(PDPage.class));
        parser.resetEngine();
        parser.processSubStream(null, resources, charStream);
        return parser.getWidth();
    }
View Full Code Here

TOP

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

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.