diff --git a/validation-model/src/main/java/org/verapdf/gf/model/GFModelParser.java b/validation-model/src/main/java/org/verapdf/gf/model/GFModelParser.java index bf3125f0f..25d357594 100644 --- a/validation-model/src/main/java/org/verapdf/gf/model/GFModelParser.java +++ b/validation-model/src/main/java/org/verapdf/gf/model/GFModelParser.java @@ -204,10 +204,13 @@ private static PDFAFlavour obtainArlingtonFlavour(PDDocument document, PDFAFlavo } COSDocument cosDocument = document.getDocument(); Float version = cosDocument != null ? cosDocument.getHeader().getVersion() : null; - if (version == null) { - PDCatalog catalog = document.getCatalog(); - ASAtom versionValue = catalog != null ? catalog.getNameKey(ASAtom.VERSION) : null; - version = versionValue != null ? Float.valueOf(versionValue.getValue()) : null; + + PDCatalog catalog = document.getCatalog(); + ASAtom versionValue = catalog != null ? catalog.getNameKey(ASAtom.VERSION) : null; + Float catalogVersion = versionValue != null ? Float.valueOf(versionValue.getValue()) : null; + + if (catalogVersion != null && (version == null || version < catalogVersion)) { + version = catalogVersion; } if (version == null) { return defaultFlavour;