Package org.apache.pdfbox.preflight.ValidationResult

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


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


            ColorSpaceHelper csh = csFact.getColorSpaceHelper(context, pColorSpace, ColorSpaceRestriction.NO_PATTERN);
            csh.validate();
        }
        catch (IOException e)
        {
            context.addValidationError(new ValidationError(ERROR_GRAPHIC_INVALID_UNKNOWN_COLOR_SPACE, e.getMessage()));
        }
            }
View Full Code Here

        areFieldsPResent &= fontDictionary.containsKey(COSName.DESCENDANT_FONTS);
        areFieldsPResent &= fontDictionary.containsKey(COSName.ENCODING);

        if (!areFieldsPResent)
        {
            this.fontContainer.push(new ValidationError(ERROR_FONTS_DICTIONARY_INVALID,
                    "Some keys are missing from composite font dictionary"));
        }
    }
View Full Code Here

        {
            /*
             * in PDF 1.4, this array must contain only one element, because of a PDF/A should be a PDF 1.4, this method
             * returns an error if the array has more than one element.
             */
            this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_INVALID,
                    "CIDFont is missing from the DescendantFonts array or the size of array is greater than 1"));
            return;
        }

        COSDictionary cidFont = COSUtils.getAsDictionary(array.get(0), cosDocument);
        if (cidFont == null)
        {
            this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_INVALID,
                    "The DescendantFonts array should have one element with is a dictionary."));
            return;
        }

        FontValidator<? extends FontContainer> cidFontValidator = createDescendantValidator(cidFont);
View Full Code Here

        {
            cidFontValidator = createCIDType2FontValidator(cidFont);
        }
        else
        {
            this.fontContainer.push(new ValidationError(ERROR_FONTS_DICTIONARY_INVALID,
                    "Type and/or Subtype keys are missing"));
        }
        return cidFontValidator;
    }
View Full Code Here

        {
            return new CIDType0FontValidator(context, new PDCIDFontType0(fDict, (PDType0Font)font));
        }
        catch (IOException e)
        {
            this.fontContainer.push(new ValidationError(ERROR_FONTS_CID_DAMAGED, "The CIDType0 font is damaged"));
            return null;
        }
    }
View Full Code Here

        {
            return new CIDType2FontValidator(context, new PDCIDFontType2(fDict, (PDType0Font)font));
        }
        catch (IOException e)
        {
            this.fontContainer.push(new ValidationError(ERROR_FONTS_CID_DAMAGED, "The CIDType2 font is damaged"));
            return null;
        }
    }
View Full Code Here

            // if encoding is a string, only 2 values are allowed
            String str = COSUtils.getAsString(encoding, cosDocument);
            if (!(FONT_DICTIONARY_VALUE_CMAP_IDENTITY_V.equals(str) || FONT_DICTIONARY_VALUE_CMAP_IDENTITY_H
                    .equals(str)))
            {
                this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_INVALID,
                        "The CMap is a string but it isn't an Identity-H/V"));
                return;
            }
        }
        else if (COSUtils.isStream(encoding, cosDocument))
        {
            /*
             * If the CMap is a stream, some fields are mandatory and the CIDSytemInfo must be compared with the
             * CIDSystemInfo entry of the CIDFont.
             */
            processCMapAsStream(COSUtils.getAsStream(encoding, cosDocument));
        }
        else
        {
            // CMap type is invalid
            this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_CMAP_INVALID_OR_MISSING,
                    "The CMap type is invalid"));
        }
    }
View Full Code Here

            String type = aCMap.getNameAsString(COSName.TYPE);
            String cmapName = aCMap.getNameAsString(COSName.getPDFName(FONT_DICTIONARY_KEY_CMAP_NAME));

            if (cmapName == null || "".equals(cmapName) || wmode > 1)
            {
                this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_CMAP_INVALID_OR_MISSING,
                        "Some elements in the CMap dictionary are missing or invalid"));
            }
            else if (!(wmValue == wmode && cmapName.equals(cmnValue)))
            {
                this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_CMAP_INVALID_OR_MISSING,
                        "CMapName or WMode is inconsistent"));
            }
            else if (!FONT_DICTIONARY_VALUE_TYPE_CMAP.equals(type))
            {
                this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_CMAP_INVALID_OR_MISSING,
                        "The CMap type is invalid"));
            }
        }
        catch (IOException e)
        {
            this.fontContainer.push(new ValidationError(ERROR_FONTS_CID_CMAP_DAMAGED, "The CMap type is damaged"));
        }

        COSDictionary cmapUsed = (COSDictionary) aCMap.getDictionaryObject(COSName
                .getPDFName(FONT_DICTIONARY_KEY_CMAP_USECMAP));
        if (cmapUsed != null)
View Full Code Here

            COSBase sup = cidSysInfo.getItem(COSName.SUPPLEMENT);

            if (!(COSUtils.isString(reg, cosDocument) && COSUtils.isString(ord, cosDocument) && COSUtils.isInteger(sup,
                    cosDocument)))
            {
                this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_SYSINFO));
                result = false;
            }

        }
        else
        {
            this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_SYSINFO));
            result = false;
        }
        return result;
    }
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.