Skip to content

Commit 907f5e9

Browse files
committed
[RELEASE] iText pdfSweep 5.0.4
2 parents 39f1e0f + 5cb1300 commit 907f5e9

File tree

7 files changed

+25
-55
lines changed

7 files changed

+25
-55
lines changed

pom.xml

Lines changed: 8 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
<parent>
66
<groupId>com.itextpdf</groupId>
77
<artifactId>root</artifactId>
8-
<version>9.3.0</version>
8+
<version>9.4.0</version>
99
<relativePath />
1010
</parent>
1111

1212
<artifactId>cleanup</artifactId>
13-
<version>5.0.3</version>
13+
<version>5.0.4</version>
1414

1515
<name>pdfSweep</name>
1616
<description>Redact PDF documents. If you have to share PDFs with different departments or send them out of house, but
@@ -34,6 +34,12 @@
3434
<itext.version>${project.parent.version}</itext.version>
3535
<sourceFolder>${project.basedir}/src/main/java</sourceFolder>
3636
<testSourceFolder>${project.basedir}/src/test/java</testSourceFolder>
37+
38+
<sharpen.phase>install</sharpen.phase>
39+
<sharpen.projectName>cleanup</sharpen.projectName>
40+
<sharpen.cSharpTargetFolder>./../../sharp/cleanup</sharpen.cSharpTargetFolder>
41+
<sharpen.cSharpSourceCodeDestination>itext/itext.cleanup</sharpen.cSharpSourceCodeDestination>
42+
<sharpen.cSharpTestCodeDestination>itext.tests/itext.cleanup.tests</sharpen.cSharpTestCodeDestination>
3743
</properties>
3844

3945
<dependencies>
@@ -100,48 +106,4 @@
100106
<url>https://repo.itextsupport.com/releases</url>
101107
</repository>
102108
</repositories>
103-
104-
<profiles>
105-
<profile>
106-
<id>with-sharpen</id>
107-
<build>
108-
<plugins>
109-
<plugin>
110-
<groupId>sharpen</groupId>
111-
<artifactId>sharpen-maven-plugin</artifactId>
112-
<version>1.0-SNAPSHOT</version>
113-
<executions>
114-
<execution>
115-
<phase>install</phase>
116-
<goals>
117-
<goal>sharpen</goal>
118-
</goals>
119-
</execution>
120-
</executions>
121-
<dependencies>
122-
<dependency>
123-
<groupId>sharpen</groupId>
124-
<artifactId>standard-framework-mapping</artifactId>
125-
<version>1.0-SNAPSHOT</version>
126-
</dependency>
127-
</dependencies>
128-
<configuration>
129-
<projectName>cleanup</projectName>
130-
<cSharpTargetFolder>./../../sharp/cleanup</cSharpTargetFolder>
131-
<cSharpSourceCodeDestination>itext/itext.cleanup</cSharpSourceCodeDestination>
132-
<cSharpTestCodeDestination>itext.tests/itext.cleanup.tests</cSharpTestCodeDestination>
133-
<buildDotnet>${sharpen.builddotnet}</buildDotnet>
134-
<showDiff>${sharpen.showdiff}</showDiff>
135-
<sourceCodeFiles>
136-
<file>**/src/main/java/**/*.java</file>
137-
</sourceCodeFiles>
138-
<testCodeFiles>
139-
<file>**/src/test/java/**/*.java</file>
140-
</testCodeFiles>
141-
</configuration>
142-
</plugin>
143-
</plugins>
144-
</build>
145-
</profile>
146-
</profiles>
147109
</project>

src/main/java/com/itextpdf/pdfcleanup/PdfCleanUpProcessor.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,9 @@ private PdfImageXObject getFilteredImage(FilteredImagesCache.FilteredImageKey fi
723723
imageToWrite.put(PdfName.SMaskInData, originalImage.getPdfObject().get(PdfName.SMaskInData));
724724
}
725725
}
726+
if (originalImage.getPdfObject().containsKey(PdfName.Decode)) {
727+
imageToWrite.put(PdfName.Decode, originalImage.getPdfObject().get(PdfName.Decode));
728+
}
726729
}
727730
} else {
728731
imageToWrite = originalImage;

src/main/java/com/itextpdf/pdfcleanup/actions/data/PdfSweepProductData.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class PdfSweepProductData {
3131
public static final String PDF_SWEEP_PRODUCT_NAME = "pdfSweep";
3232
public static final String PDF_SWEEP_PUBLIC_PRODUCT_NAME = PDF_SWEEP_PRODUCT_NAME;
3333

34-
private static final String PDF_SWEEP_VERSION = "5.0.3";
34+
private static final String PDF_SWEEP_VERSION = "5.0.4";
3535
private static final int PDF_SWEEP_COPYRIGHT_SINCE = 2000;
3636
private static final int PDF_SWEEP_COPYRIGHT_TO = 2025;
3737

src/test/java/com/itextpdf/pdfcleanup/UnsupportedImageTypeTest.java

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,12 @@ public void checkUnSupportedImageTypeTest() throws IOException, InterruptedExcep
6262
Rectangle area = pdfDocument.getPage(pageIndex).getPageSize();
6363
workingTool.addCleanupLocation(new PdfCleanUpLocation(pageIndex, area, ColorConstants.RED));
6464

65-
String java_ver = System.getProperty("java.version");
66-
System.out.println("Java Version: " + java_ver);
65+
String javaVendor = System.getProperty("java.vendor");
66+
System.out.println("Java Vendor: " + javaVendor);
67+
String javaVer = System.getProperty("java.version");
68+
System.out.println("Java Version: " + javaVer);
6769

68-
if (isFixedInJdk(java_ver)) {
70+
if (isFixedInJdk(javaVer, javaVendor)) {
6971
workingTool.cleanUp();
7072
pdfDocument.close();
7173
compareByContent(cmp, output, OUTPUT_PATH, "diff_UnsupportedImageType_");
@@ -80,18 +82,21 @@ public void checkUnSupportedImageTypeTest() throws IOException, InterruptedExcep
8082

8183
}
8284

83-
private static boolean isFixedInJdk(String versionStr) {
84-
//fixed for jdk8 from 351 onwards, for jdk11 from 16 onwards and for jdk17 starting from 4
85+
private static boolean isFixedInJdk(String versionStr, String vendorStr) {
86+
//Fixed CMYK bug https://bugs.openjdk.org/browse/JDK-8274735 for openJDK:
87+
//jdk8 from 351 onwards, for jdk11 from 16 onwards and for jdk17 starting from 4.
88+
//Amazon corretto jdk started support CMYK for JPEG from 11 version.
8589
boolean isFixed = false;
8690
int majorVer = getMajorVer(versionStr);
8791
String[] split = versionStr.split("[._-]");
8892
int minorVer = Integer.parseInt(split[split.length - 1]);
8993

90-
if (minorVer % 10 == 2) {
91-
return false;
92-
}
9394
switch (majorVer) {
9495
case 8:
96+
if ("Amazon.com Inc.".equals(vendorStr)) {
97+
return false;
98+
}
99+
95100
isFixed = minorVer >= 351;
96101
break;
97102
case 11:
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)