public void validate(PreflightContext ctx) throws ValidationException
{
PDDocumentCatalog catalog = ctx.getDocument().getDocumentCatalog();
if (catalog != null)
{
PDDocumentOutline outlineHierarchy = catalog.getDocumentOutline();
if (outlineHierarchy != null)
{
// Count entry is mandatory if there are childrens
if (!isCountEntryPresent(outlineHierarchy.getCOSDictionary())
&& (outlineHierarchy.getFirstChild() != null || outlineHierarchy.getLastChild() != null))
{
addValidationError(ctx, new ValidationError(ERROR_SYNTAX_TRAILER_OUTLINES_INVALID,
"Outline Hierarchy doesn't have Count entry"));
}
else if (isCountEntryPositive(ctx, outlineHierarchy.getCOSDictionary())
&& (outlineHierarchy.getFirstChild() == null || outlineHierarchy.getLastChild() == null))
{
addValidationError(ctx, new ValidationError(ERROR_SYNTAX_TRAILER_OUTLINES_INVALID,
"Outline Hierarchy doesn't have First and/or Last entry(ies)"));
}
else
{
exploreOutlineLevel(ctx, outlineHierarchy.getFirstChild());
}
}
}
else
{