Package org.apache.pdfbox.preflight

Examples of org.apache.pdfbox.preflight.PreflightPath


public class ShaddingPatternValidationProcess extends AbstractProcess
{

    public void validate(PreflightContext context) throws ValidationException
    {
        PreflightPath vPath = context.getValidationPath();
        if (vPath.isEmpty()) {
            return;
        }
        else if (!vPath.isExpectedType(PDShading.class))
        {
            context.addValidationError(new ValidationError(PreflightConstants.ERROR_GRAPHIC_MISSING_OBJECT, "ShadingPattern validation required at least a PDResources"));
        }
        else
        {
            PDShading shaddingResource = (PDShading) vPath.peek();
            PDPage page = vPath.getClosestPathElement(PDPage.class);
            checkColorSpace(context, page, shaddingResource);
            checkGraphicState(context, page, shaddingResource);
        }
    }
View Full Code Here


     *
     * @return the width of the character
     */
    private float getWidthFromCharProc(PDType3CharProc charProc) throws IOException
    {
        PreflightPath vPath = context.getValidationPath();
        PreflightType3Stream parser = new PreflightType3Stream(context, vPath.getClosestPathElement(PDPage.class), charProc);
        parser.showType3Character(charProc);
        return parser.getWidth();
    }
View Full Code Here

public class SinglePageValidationProcess extends AbstractProcess
{

    public void validate(PreflightContext context) throws ValidationException
    {
        PreflightPath vPath = context.getValidationPath();
        if (vPath.isEmpty()){
            return;
        }
        else if (!vPath.isExpectedType(PDPage.class))
        {
            addValidationError(context, new ValidationError(PreflightConstants.ERROR_PDF_PROCESSING_MISSING, "Page validation required at least a PDPage"));
        }
        else
        {
            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()) {
            return;
        }
        else if (!vPath.isExpectedType(PDTilingPattern.class))
        {
            context.addValidationError(new ValidationError(PreflightConstants.ERROR_GRAPHIC_MISSING_OBJECT, "Tiling pattern validation required at least a PDPage"));
        }
        else
        {
            PDTilingPattern tilingPattern = (PDTilingPattern) 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()) {
            return;
        }
        else if (!vPath.isExpectedType(PDFont.class))
        {
            context.addValidationError(new ValidationError(PreflightConstants.ERROR_FONTS_INVALID_DATA, "Font validation process needs at least one PDFont object"));
        }
        else
        {
            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);
                if (validator != null) validator.validate();
View Full Code Here

public class GraphicObjectPageValidationProcess extends AbstractProcess
{

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

        XObjectValidator validator = null;
        if (!vPath.isEmpty() && vPath.isExpectedType(PDImageXObject.class))
        {
            validator = new XObjImageValidator(context, (PDImageXObject) vPath.peek());
        }
        else if (!vPath.isEmpty() && vPath.isExpectedType(PDFormXObject.class))
        {
            validator = new XObjFormValidator(context, (PDFormXObject) vPath.peek());
        }
        else if (!vPath.isEmpty() && vPath.isExpectedType(PDPostScriptXObject.class))
        {
            validator = new XObjPostscriptValidator(context, (PDPostScriptXObject) vPath.peek());
        }
        else if (!vPath.isEmpty() && vPath.isExpectedType(COSStream.class))
        {
            context.addValidationError(new ValidationError(PreflightConstants.ERROR_GRAPHIC_XOBJECT_INVALID_TYPE, "Invalid XObject subtype"));
        }
        else
        {
View Full Code Here

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

    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)
        {
            PDColorSpace defaultCS = null;

            try
View Full Code Here

     * @param context the context which contains the Resource dictionary.
     * @throws ValidationException thrown if a the Extended Graphic State isn't valid.
     */
    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

     * 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();
        PreflightContentStream csWrapper = new PreflightContentStream(context, vPath.getClosestPathElement(PDPage.class));
        csWrapper.validXObjContentStream(pdXObj);
    }
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.