Skip to content

Commit

Permalink
Support several flavours
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximPlusov committed Jul 30, 2024
1 parent 9ef78b9 commit 50df6f1
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import org.verapdf.containers.StaticCoreContainers;
import org.verapdf.xmp.containers.StaticXmpCoreContainers;
import org.verapdf.xmp.impl.VeraPDFMeta;

import java.util.Collections;
import java.util.logging.Logger;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.common.PDMetadata;
Expand Down Expand Up @@ -69,7 +71,7 @@ public final class ModelParser implements PDFAParser {

private PDDocument document;

private final PDFAFlavour flavour;
private PDFAFlavour flavour;

private ModelParser(final InputStream docStream, PDFAFlavour flavour, PDFAFlavour defaultFlavour) throws IOException {
this.document = PDDocument.load(docStream, false, true);
Expand Down Expand Up @@ -195,6 +197,16 @@ public PDFAFlavour getFlavour() {
return this.flavour;
}

@Override
public List<PDFAFlavour> getFlavours() {
return Collections.singletonList(flavour);
}

@Override
public void setFlavours(List<PDFAFlavour> flavours) {
this.flavour = flavours.get(0);
}

@Override
public FeatureExtractionResult getFeatures(FeatureExtractorConfig config) {
return PBFeatureParser.getFeaturesCollection(this.document, config);
Expand Down

0 comments on commit 50df6f1

Please sign in to comment.