Examples of PreflightPath


Examples of org.apache.pdfbox.preflight.PreflightPath

public class GraphicObjectPageValidationProcess extends AbstractProcess
{

    public void validate(PreflightContext context) throws ValidationException
    {
        PreflightPath vPath = context.getValidationPath();

        XObjectValidator validator = null;
        if (!vPath.isEmpty() && vPath.isExpectedType(PDXObjectImage.class))
        {
            validator = new XObjImageValidator(context, (PDXObjectImage) vPath.peek());
        }
        else if (!vPath.isEmpty() && vPath.isExpectedType(PDXObjectForm.class))
        {
            validator = new XObjFormValidator(context, (PDXObjectForm) vPath.peek());
        }
        else if (!vPath.isEmpty() && vPath.isExpectedType(COSStream.class))
        {
            COSStream stream = (COSStream) vPath.peek();
            String subType = stream.getNameAsString(COSName.SUBTYPE);
            if (XOBJECT_DICTIONARY_VALUE_SUBTYPE_POSTSCRIPT.equals(subType))
            {
                validator = new XObjPostscriptValidator(context, stream);
            }
View Full Code Here

Examples of org.apache.pdfbox.preflight.PreflightPath

public class ResourcesValidationProcess extends AbstractProcess
{

    public void validate(PreflightContext ctx) throws ValidationException
    {
        PreflightPath vPath = ctx.getValidationPath();
        if (vPath.isEmpty()) {
            return;
        }
        else if (!vPath.isExpectedType(PDResources.class))
        {
            addValidationError(ctx, new ValidationError(PreflightConstants.ERROR_PDF_PROCESSING_MISSING, "Resources validation process needs at least one PDResources object"));
        }
        else
        {

            PDResources resources = (PDResources) vPath.peek();

            validateFonts(ctx, resources);
            validateExtGStates(ctx, resources);
            validateShadingPattern(ctx, resources);
            validateTilingPattern(ctx, resources);
View Full Code Here

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()) {
            return;
        }
        else if (!vPath.isExpectedType(COSDictionary.class))
        {
            context.addValidationError(new ValidationError(PreflightConstants.ERROR_GRAPHIC_XOBJECT_INVALID_TYPE, "ExtGState validation required at least a Resource dictionary"));
        }
        else
        {
            COSDictionary extGStatesDict = (COSDictionary) vPath.peek();
            List<COSDictionary> listOfExtGState = extractExtGStateDictionaries(context, extGStatesDict);
            validateTransparencyRules(context, listOfExtGState);
        }
    }
View Full Code Here

Examples of org.apache.pdfbox.preflight.PreflightPath

public class AnnotationValidationProcess extends AbstractProcess
{

    public void validate(PreflightContext context) throws ValidationException
    {
        PreflightPath vPath = context.getValidationPath();
        if (vPath.isEmpty()) {
            return;
        }
        else if (!vPath.isExpectedType(COSDictionary.class))
        {
            context.addValidationError(new ValidationError(PreflightConstants.ERROR_ANNOT_INVALID_ELEMENT, "Annotation validation process needs at least one COSDictionary object"));
        }
        else
        {
            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

Examples of org.apache.pdfbox.preflight.PreflightPath

     *
     * @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

Examples of org.apache.pdfbox.preflight.PreflightPath

    protected boolean processDefaultColorSpace(PDColorSpace pdcs)
    {
        boolean result = false;

        // get default color space
        PreflightPath vPath = context.getValidationPath();
        PDResources resources = vPath.getClosestPathElement(PDResources.class);
        if (resources != null && resources.getColorSpaces() != null)
        {
            PDColorSpace defaultCS = null;

            Map<String, PDColorSpace> colorsSpaces = resources.getColorSpaces();
View Full Code Here

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()) {
            return;
        }
        else if (!vPath.isExpectedType(COSDictionary.class))
        {
            context.addValidationError(new ValidationError(PreflightConstants.ERROR_GRAPHIC_XOBJECT_INVALID_TYPE, "ExtGState validation required at least a Resource dictionary"));
        }
        else
        {
            COSDictionary extGStatesDict = (COSDictionary) vPath.peek();
            List<COSDictionary> listOfExtGState = extractExtGStateDictionaries(context, extGStatesDict);
            validateTransparencyRules(context, listOfExtGState);
        }
    }
View Full Code Here

Examples of org.apache.pdfbox.preflight.PreflightPath

        if (context == null)
        {
            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

Examples of org.apache.pdfbox.preflight.PreflightPath

public class GraphicObjectPageValidationProcess extends AbstractProcess
{

    public void validate(PreflightContext context) throws ValidationException
    {
        PreflightPath vPath = context.getValidationPath();

        XObjectValidator validator = null;
        if (!vPath.isEmpty() && vPath.isExpectedType(PDXObjectImage.class))
        {
            validator = new XObjImageValidator(context, (PDXObjectImage) vPath.peek());
        }
        else if (!vPath.isEmpty() && vPath.isExpectedType(PDXObjectForm.class))
        {
            validator = new XObjFormValidator(context, (PDXObjectForm) vPath.peek());
        }
        else if (!vPath.isEmpty() && vPath.isExpectedType(COSStream.class))
        {
            COSStream stream = (COSStream) vPath.peek();
            String subType = stream.getNameAsString(COSName.SUBTYPE);
            if (XOBJECT_DICTIONARY_VALUE_SUBTYPE_POSTSCRIPT.equals(subType))
            {
                validator = new XObjPostscriptValidator(context, stream);
            }
View Full Code Here

Examples of org.apache.pdfbox.preflight.PreflightPath

public class ResourcesValidationProcess extends AbstractProcess
{

    public void validate(PreflightContext ctx) throws ValidationException
    {
        PreflightPath vPath = ctx.getValidationPath();
        if (vPath.isEmpty() && !vPath.isExpectedType(PDResources.class))
        {
            throw new ValidationException("Resources validation process needs at least one PDResources object");
        }

        PDResources resources = (PDResources) vPath.peek();

        validateFonts(ctx, resources);
        validateExtGStates(ctx, resources);
        validateShadingPattern(ctx, resources);
        validateTilingPattern(ctx, resources);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.