Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update GFPDExtGState methods #672

Merged
merged 2 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,15 @@ public ComponentDetails getDetails() {
}

/**
* @see org.verapdf.pdfa.VeraPDFFoundry#newPdfParser(java.io.InputStream)
* @see org.verapdf.pdfa.VeraPDFFoundry#createParser(InputStream)
*/
@Override
public PDFAParser createParser(InputStream pdfStream) throws ModelParsingException, EncryptedPdfException {
return createParser(pdfStream, PDFAFlavour.NO_FLAVOUR);
}

/**
* @see org.verapdf.pdfa.VeraPDFFoundry#newPdfParser(java.io.InputStream,
* org.verapdf.pdfa.flavours.PDFAFlavour)
* @see org.verapdf.pdfa.VeraPDFFoundry#createParser(InputStream, PDFAFlavour)
*/
@Override
public PDFAParser createParser(InputStream pdfStream, PDFAFlavour flavour)
Expand Down Expand Up @@ -127,7 +126,7 @@ public PDFAParser createParser(File file)
}

/**
* @see org.verapdf.pdfa.VeraPDFFoundry#newMetadataFixer(org.verapdf.metadata.fixer.utils.FixerConfig)
* @see VeraPDFFoundry#createMetadataFixer()
*/
@Override
public MetadataFixer createMetadataFixer() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,26 +60,6 @@ public GFPDExtGState(org.verapdf.pd.PDExtGState state) {
super(state, EXT_G_STATE_TYPE);
}

@Override
public String getTR() {
return getStringProperty(((org.verapdf.pd.PDExtGState) simplePDObject).getCOSTR());
}

@Override
public String getTR2() {
return getStringProperty(((org.verapdf.pd.PDExtGState) simplePDObject).getCOSTR2());
}

@Override
public String getSMask() {
return getStringProperty(((org.verapdf.pd.PDExtGState) simplePDObject).getCOSSMask());
}

@Override
public String getBM() {
return getStringProperty(((org.verapdf.pd.PDExtGState) simplePDObject).getCOSBM());
}

private List<CosBM> getlinkBM() {
COSObject BM = ((org.verapdf.pd.PDExtGState)simplePDObject).getCOSBM();
if (BM == null || BM.empty() || BM.getType() == COSObjType.COS_NULL) {
Expand Down Expand Up @@ -130,17 +110,19 @@ public Double getCA() {
return 2.0; // check is failed
}

private static String getStringProperty(COSObject property) {
if (property == null
|| property.empty()
|| property.getType() == COSObjType.COS_NULL) {
return null;
}
@Override
public String getTR2NameValue() {
return simplePDObject.getNameKeyStringValue(ASAtom.TR2);
}

if (property.getType() == COSObjType.COS_NAME) {
return property.getName().getValue();
}
return property.toString();
@Override
public Boolean getcontainsTR() {
return simplePDObject.knownKey(ASAtom.TR);
}

@Override
public Boolean getcontainsTR2() {
return simplePDObject.knownKey(ASAtom.TR2);
}

@Override
Expand All @@ -153,6 +135,21 @@ public Boolean getcontainsHTO() {
return this.simplePDObject.knownKey(ASAtom.HTO);
}

@Override
public String getSMaskNameValue() {
return simplePDObject.getNameKeyStringValue(ASAtom.SMASK);
}

@Override
public Boolean getcontainsSMask() {
return simplePDObject.knownKey(ASAtom.SMASK);
}

@Override
public String getBMNameValue() {
return simplePDObject.getNameKeyStringValue(ASAtom.BM);
}

@Override
public List<? extends Object> getLinkedObjects(String link) {
switch (link) {
Expand Down