Examples of PreflightPath


Examples of org.apache.pdfbox.preflight.PreflightPath

     * @throws ValidationException
     */
    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

Examples of org.apache.pdfbox.preflight.PreflightPath

     * @throws ValidationException
     */
    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

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 ShaddingPatternValidationProcess extends AbstractProcess
{

    public void validate(PreflightContext context) throws ValidationException
    {
        PreflightPath vPath = context.getValidationPath();
        if (vPath.isEmpty()) {
            return;
        }
        else if (!vPath.isExpectedType(PDShadingResources.class))
        {
            context.addValidationError(new ValidationError(PreflightConstants.ERROR_GRAPHIC_MISSING_OBJECT, "ShadingPattern validation required at least a PDResources"));
        }
        else
        {
            PDShadingResources shaddingResource = (PDShadingResources) vPath.peek();
            PDPage page = vPath.getClosestPathElement(PDPage.class);
            checkColorSpace(context, page, shaddingResource);
            checkGraphicState(context, page, shaddingResource);
        }
    }
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

     * 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

Examples of org.apache.pdfbox.preflight.PreflightPath

public class ActionsValidationProcess 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_ACTION_INVALID_TYPE, "Action validation process needs at least one COSDictionary object"));
        }
        else
        {
            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

Examples of org.apache.pdfbox.preflight.PreflightPath

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

Examples of org.apache.pdfbox.preflight.PreflightPath

public class TilingPatternValidationProcess extends AbstractProcess
{

    public void validate(PreflightContext context) throws ValidationException
    {
        PreflightPath vPath = context.getValidationPath();
        if (vPath.isEmpty()) {
            return;
        }
        else if (!vPath.isExpectedType(PDTilingPatternResources.class))
        {
            context.addValidationError(new ValidationError(PreflightConstants.ERROR_GRAPHIC_MISSING_OBJECT, "Tiling pattern validation required at least a PDPage"));
        }
        else
        {
            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

Examples of org.apache.pdfbox.preflight.PreflightPath

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
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.