RED-8212: fix specific case

This commit is contained in:
Kilian Schuettler 2024-01-23 12:31:53 +01:00
parent ab4a4619bc
commit 2a9583318b

View File

@ -89,7 +89,7 @@ public class InvisibleElementRemovalService {
* This method is similar to {@link #removeInvisibleElements(InputStream, OutputStream, boolean, boolean)}, just with a PDFDoc.
*/
@SneakyThrows
public void removeInvisibleElements(PDFDoc pdfDoc, boolean removePaths, boolean delta) {
public void removeInvisibleElements(PDFDoc pdfDoc, boolean delta, boolean removePaths) {
execute(pdfDoc, delta, removePaths);
}
@ -314,10 +314,13 @@ public class InvisibleElementRemovalService {
context.visibleElements().removeAll(currentOverlappedElements);
}
context.visibleElements().add(ElementFeatureFactory.extractFeatures(pathElement));
if (!context.delta() || !context.removePaths()) {
if (!context.delta()) {
writer.writeElement(pathElement);
}
} else if (!context.delta() && !context.removePaths()) {
writer.writeElement(pathElement);
}
if (context.delta() && !inClippingPath && context.removePaths()) {
pathElement.getGState().setFillColorSpace(ColorSpace.createDeviceRGB());
pathElement.getGState().setFillColor(new ColorPt(1, 0, 0));