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

FIxes missing popups #141

Merged
merged 11 commits into from
Sep 23, 2020
17 changes: 14 additions & 3 deletions core/core-awt/src/main/java/org/icepdf/core/pobjects/Page.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.icepdf.core.pobjects.annotations.Annotation;
import org.icepdf.core.pobjects.annotations.FreeTextAnnotation;
import org.icepdf.core.pobjects.annotations.MarkupAnnotation;
import org.icepdf.core.pobjects.annotations.PopupAnnotation;
import org.icepdf.core.pobjects.graphics.Shapes;
import org.icepdf.core.pobjects.graphics.WatermarkCallback;
import org.icepdf.core.pobjects.graphics.text.GlyphText;
Expand All @@ -34,10 +35,8 @@
import java.awt.geom.*;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.*;
import java.util.List;
import java.util.Stack;
import java.util.logging.Level;
import java.util.logging.Logger;

Expand Down Expand Up @@ -359,6 +358,18 @@ else if (annotObj instanceof HashMap) { // HashMap lacks "Type"->"Annot" entry
a != null ? " " + a.getPObjectReference() + a.getEntries() : "");
}
}
//The popup annotations may not be referenced in the page annotations entry, we have to add them manually.
final Set<Annotation> annotSet = new HashSet<>(annotations);
for (final Annotation annot : annotSet) {
if (annot instanceof MarkupAnnotation) {
final PopupAnnotation popup = ((MarkupAnnotation) annot).getPopupAnnotation();
if (popup != null && !annotSet.contains(popup)) {
popup.init();
v.add(popup);
annotations.add(popup);
}
}
}
}
}

Expand Down