Package org.apache.pdfbox.preflight.ValidationResult

Examples of org.apache.pdfbox.preflight.ValidationResult.ValidationError


                // EOL is authorized
                if ((buf.length - tmpOffset) > 2
                        || (buf.length - tmpOffset == 2 && (buf[tmpOffset] != 13 || buf[tmpOffset + 1] != 10))
                        || (buf.length - tmpOffset == 1 && buf[tmpOffset] != 10))
                {
                    addValidationError(new ValidationError(ERROR_SYNTAX_TRAILER_EOF,
                            "File contains data after the last %%EOF sequence at offset " + pdfSource.getOffset()));
                }
            }
        }
        return offset;
View Full Code Here


        COSBase smask = xobject.getItem(COSName.SMASK);
        if (smask != null
                && !(COSUtils.isString(smask, cosDocument) && TRANSPARENCY_DICTIONARY_VALUE_SOFT_MASK_NONE
                        .equals(COSUtils.getAsString(smask, cosDocument))))
        {
            context.addValidationError(new ValidationError(ERROR_GRAPHIC_TRANSPARENCY_SMASK,
                    "Soft Mask must be null or None ["+xobject.toString()+"]"));
        }
    }
View Full Code Here

    protected void checkOPI()
    {
        // 6.2.4 and 6.2.5 no OPI
        if (this.xobject.getItem(COSName.getPDFName("OPI")) != null)
        {
            context.addValidationError(new ValidationError(ERROR_GRAPHIC_UNEXPECTED_KEY, "Unexpected 'OPI' Key"));
        }
    }
View Full Code Here

    protected void checkReferenceXObject()
    {
        // 6.2.6 No reference xobject
        if (this.xobject.getItem("Ref") != null)
        {
            context.addValidationError(new ValidationError(ERROR_GRAPHIC_UNEXPECTED_KEY,
                    "No reference Xobject allowed in PDF/A"));
        }
    }
View Full Code Here

    {
        // 6.2.7 No PostScript XObjects
        String subtype = this.xobject.getNameAsString(COSName.SUBTYPE);
        if (subtype != null && XOBJECT_DICTIONARY_VALUE_SUBTYPE_POSTSCRIPT.equals(subtype))
        {
            context.addValidationError(new ValidationError(ERROR_GRAPHIC_UNEXPECTED_VALUE_FOR_KEY,
                    "No Postscript Xobject allowed in PDF/A"));
            return;
        }
        if (this.xobject.getItem(COSName.getPDFName("Subtype2")) != null)
        {
            context.addValidationError(new ValidationError(ERROR_GRAPHIC_UNEXPECTED_VALUE_FOR_KEY,
                    "No Postscript Xobject allowed in PDF/A (Subtype2)"));
            return;
        }
    }
View Full Code Here

        boolean lastMod = this.xobject.getItem(COSName.LAST_MODIFIED) != null;
        boolean pieceInfo = this.xobject.getItem("PieceInfo") != null;
        // type and subtype checked before to create the Validator.
        if (lastMod ^ pieceInfo)
        {
            context.addValidationError(new ValidationError(ERROR_GRAPHIC_MISSING_FIELD));
            return;
        }

        COSBase bbBase = this.xobject.getItem(COSName.BBOX);
        // ---- BBox is an Array (Rectangle)
        if (bbBase == null || !COSUtils.isArray(bbBase, cosDocument))
        {
            context.addValidationError(new ValidationError(ERROR_GRAPHIC_INVALID_BBOX));
            return;
        }
    }
View Full Code Here

        COSDictionary groupDictionary = COSUtils.getAsDictionary(baseGroup, cosDocument);
        if (groupDictionary != null)
        {
            if (!XOBJECT_DICTIONARY_KEY_GROUP.equals(groupDictionary.getNameAsString(COSName.TYPE)))
            {
                context.addValidationError(new ValidationError(PreflightConstants.ERROR_GRAPHIC_MISSING_FIELD, "The Group dictionary hasn't Group as Type value"));
            }
            else
            {
                String sVal = groupDictionary.getNameAsString(COSName.S);
                if (sVal == null || XOBJECT_DICTIONARY_VALUE_S_TRANSPARENCY.equals(sVal))
                {
                    context.addValidationError(new ValidationError(ERROR_GRAPHIC_TRANSPARENCY_GROUP, "Group has a transparency S entry or the S entry is null ["+xobject.toString()+"]"));
                    return;
                }
            }
        }
    }
View Full Code Here

    protected void checkPS()
    {
        // 6.2.4 and 6.2.5 no PS
        if (this.xobject.getItem(COSName.getPDFName("PS")) != null)
        {
            context.addValidationError(new ValidationError(ERROR_GRAPHIC_UNEXPECTED_KEY, "Unexpected 'PS' Key"));
            return;
        }
    }
View Full Code Here

        // 6.2.5 if Subtype2, value not PS
        if (this.xobject.getItem(COSName.getPDFName("Subtype2")) != null)
        {
            if ("PS".equals(this.xobject.getNameAsString("Subtype2")))
            {
                context.addValidationError(new ValidationError(ERROR_GRAPHIC_UNEXPECTED_VALUE_FOR_KEY,
                        "Unexpected 'PS' value for 'Subtype2' Key"));
                return;
            }
        }
    }
View Full Code Here

        PDDocument pdfbox = ctx.getDocument();
        this.catalog = pdfbox.getDocumentCatalog();

        if (this.catalog == null)
        {
            ctx.addValidationError(new ValidationError(ERROR_SYNTAX_NOCATALOG, "There are no Catalog entry in the Document."));
        }
        else
        {
            validateActions(ctx);
            validateLang(ctx);
View Full Code Here

TOP

Related Classes of org.apache.pdfbox.preflight.ValidationResult.ValidationError

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.