Skip to content

Commit

Permalink
Update getEmbeddedFiles in GFCosDocument
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximPlusov committed Nov 11, 2024
1 parent 45a8fa9 commit 444eb5e
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
import org.verapdf.gf.model.tools.FileSpecificationKeysHelper;
import org.verapdf.model.baselayer.Object;
import org.verapdf.model.coslayer.*;
import org.verapdf.pd.PDCatalog;
import org.verapdf.pd.PDNameTreeNode;
import org.verapdf.pd.PDNamesDictionary;
import org.verapdf.pdfa.flavours.PDFAFlavour;
import org.verapdf.pdfa.flavours.PDFFlavours;
import org.verapdf.tools.StaticResources;
Expand Down Expand Up @@ -394,12 +396,13 @@ public List<? extends Object> getLinkedObjects(String link) {
*/
private List<CosFileSpecification> getEmbeddedFiles() {
if (this.catalog != null) {
COSObject buffer = this.catalog.getKey(ASAtom.NAMES);
if (!buffer.empty()) {
COSObject base = buffer.getKey(ASAtom.EMBEDDED_FILES);
if (base != null && base.getType() == COSObjType.COS_DICT) {
PDCatalog catalog = StaticResources.getDocument().getCatalog();
PDNamesDictionary namesDictionary = catalog.getNamesDictionary();
if (namesDictionary != null) {
PDNameTreeNode embeddedFiles = namesDictionary.getEmbeddedFiles();
if (embeddedFiles != null) {
List<CosFileSpecification> files = new ArrayList<>();
this.getNamesEmbeddedFiles(files, PDNameTreeNode.create(base));
this.getNamesEmbeddedFiles(files, embeddedFiles);
return Collections.unmodifiableList(files);
}
}
Expand Down

0 comments on commit 444eb5e

Please sign in to comment.