Skip to content

Commit 2c081f9

Browse files
committedJul 27, 2018
[RELEASE] iText 7 pdfSweep - 2.0.2
https://github.com/itext/i7j-pdfsweep/releases/tag/2.0.2 * release/2.0.2: [RELEASE] 2.0.2-SNAPSHOT -> 2.0.2 Add missing copyright headers Remove unused fields Support event meta info Add generic event Refactor time-based system utils to better represent there purpose Update README.md Fix redaction color for second page onwards in RegexBasedCleanupStrategy [RELEASE] 2.0.1-SNAPSHOT -> 2.0.2-SNAPSHOT
2 parents 6e13b38 + bc5779f commit 2c081f9

26 files changed

+221
-47
lines changed
 

‎README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ Contact [sales] for more info.
3131
[building]: BUILDING.md
3232
[contributing]: https://github.com/itext/itext7/blob/develop/CONTRIBUTING.md
3333
[itext]: http://itextpdf.com/
34-
[github]: https://github.com/itext/pdfSweep
35-
[latest]: https://github.com/itext/pdfSweep/releases/latest
34+
[github]: https://github.com/itext/i7j-pdfsweep
35+
[latest]: https://github.com/itext/i7j-pdfsweep/releases/latest
3636
[sales]: http://itextpdf.com/sales
3737
[gratis]: https://en.wikipedia.org/wiki/Gratis_versus_libre
3838
[pdfSweep]: http://itextpdf.com/itext7/pdfSweep

‎pom.xml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
33
<modelVersion>4.0.0</modelVersion>
4-
54
<parent>
65
<groupId>com.itextpdf</groupId>
76
<artifactId>root</artifactId>
8-
<version>7.1.2</version>
9-
<relativePath />
7+
<version>7.1.3</version>
8+
<relativePath/>
109
</parent>
11-
1210
<artifactId>cleanup</artifactId>
13-
<version>2.0.1</version>
14-
11+
<version>2.0.2</version>
1512
<name>pdfSweep</name>
1613
<url>http://itextpdf.com/</url>
17-
1814
<properties>
1915
<itext.version>${project.parent.version}</itext.version>
2016
</properties>
21-
2217
<repositories>
2318
<repository>
2419
<releases>
@@ -32,7 +27,6 @@
3227
<url>https://repository.apache.org/content/repositories/snapshots/</url>
3328
</repository>
3429
</repositories>
35-
3630
<dependencies>
3731
<dependency>
3832
<groupId>com.itextpdf</groupId>
@@ -61,7 +55,6 @@
6155
<scope>test</scope>
6256
</dependency>
6357
</dependencies>
64-
6558
<build>
6659
<plugins>
6760
<plugin>

‎src/main/java/com/itextpdf/pdfcleanup/FilteredImagesCache.java

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,45 @@
1+
/*
2+
This file is part of the iText (R) project.
3+
Copyright (c) 1998-2018 iText Group NV
4+
Authors: iText Software.
5+
6+
This program is free software; you can redistribute it and/or modify
7+
it under the terms of the GNU Affero General Public License version 3
8+
as published by the Free Software Foundation with the addition of the
9+
following permission added to Section 15 as permitted in Section 7(a):
10+
FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY
11+
ITEXT GROUP. ITEXT GROUP DISCLAIMS THE WARRANTY OF NON INFRINGEMENT
12+
OF THIRD PARTY RIGHTS
13+
14+
This program is distributed in the hope that it will be useful, but
15+
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16+
or FITNESS FOR A PARTICULAR PURPOSE.
17+
See the GNU Affero General Public License for more details.
18+
You should have received a copy of the GNU Affero General Public License
19+
along with this program; if not, see http://www.gnu.org/licenses or write to
20+
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21+
Boston, MA, 02110-1301 USA, or download the license from the following URL:
22+
http://itextpdf.com/terms-of-use/
23+
24+
The interactive user interfaces in modified source and object code versions
25+
of this program must display Appropriate Legal Notices, as required under
26+
Section 5 of the GNU Affero General Public License.
27+
28+
In accordance with Section 7(b) of the GNU Affero General Public License,
29+
a covered work must retain the producer line in every PDF that is created
30+
or manipulated using iText.
31+
32+
You can be released from the requirements of the license by purchasing
33+
a commercial license. Buying such a license is mandatory as soon as you
34+
develop commercial activities involving the iText software without
35+
disclosing the source code of your own applications.
36+
These activities include: offering paid services to customers as an ASP,
37+
serving PDFs on the fly in a web application, shipping iText with a closed
38+
source product.
39+
40+
For more information, please contact iText Software Corp. at this
41+
address: sales@itextpdf.com
42+
*/
143
package com.itextpdf.pdfcleanup;
244

345
import com.itextpdf.kernel.geom.Rectangle;

‎src/main/java/com/itextpdf/pdfcleanup/LineDashPattern.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
This file is part of the iText (R) project.
3-
Copyright (c) 1998-2017 iText Group NV
3+
Copyright (c) 1998-2018 iText Group NV
44
Authors: iText Software.
55
66
This program is free software; you can redistribute it and/or modify

‎src/main/java/com/itextpdf/pdfcleanup/PdfCleanUpEventListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
This file is part of the iText (R) project.
3-
Copyright (c) 1998-2017 iText Group NV
3+
Copyright (c) 1998-2018 iText Group NV
44
Authors: iText Software.
55
66
This program is free software; you can redistribute it and/or modify

‎src/main/java/com/itextpdf/pdfcleanup/PdfCleanUpFilter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
This file is part of the iText (R) project.
3-
Copyright (c) 1998-2017 iText Group NV
3+
Copyright (c) 1998-2018 iText Group NV
44
Authors: iText Software.
55
66
This program is free software; you can redistribute it and/or modify

‎src/main/java/com/itextpdf/pdfcleanup/PdfCleanUpLocation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
This file is part of the iText (R) project.
3-
Copyright (c) 1998-2017 iText Group NV
3+
Copyright (c) 1998-2018 iText Group NV
44
Authors: iText Software.
55
66
This program is free software; you can redistribute it and/or modify

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
This file is part of the iText (R) project.
3-
Copyright (c) 1998-2017 iText Group NV
3+
Copyright (c) 1998-2018 iText Group NV
44
Authors: iText Software.
55
66
This program is free software; you can redistribute it and/or modify

‎src/main/java/com/itextpdf/pdfcleanup/PdfCleanUpTool.java

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
This file is part of the iText (R) project.
3-
Copyright (c) 1998-2017 iText Group NV
3+
Copyright (c) 1998-2018 iText Group NV
44
Authors: iText Software.
55
66
This program is free software; you can redistribute it and/or modify
@@ -51,6 +51,8 @@ This file is part of the iText (R) project.
5151
import com.itextpdf.kernel.colors.DeviceCmyk;
5252
import com.itextpdf.kernel.colors.DeviceGray;
5353
import com.itextpdf.kernel.colors.DeviceRgb;
54+
import com.itextpdf.kernel.counter.EventCounterHandler;
55+
import com.itextpdf.kernel.counter.event.IMetaInfo;
5456
import com.itextpdf.kernel.font.PdfFont;
5557
import com.itextpdf.kernel.font.PdfFontFactory;
5658
import com.itextpdf.kernel.geom.Rectangle;
@@ -75,6 +77,7 @@ This file is part of the iText (R) project.
7577
import com.itextpdf.layout.layout.LayoutArea;
7678
import com.itextpdf.layout.property.Property;
7779
import com.itextpdf.layout.property.TextAlignment;
80+
import com.itextpdf.pdfcleanup.events.PdfSweepEvent;
7881

7982
import java.io.IOException;
8083
import java.lang.reflect.Array;
@@ -114,6 +117,8 @@ public class PdfCleanUpTool {
114117

115118
private boolean processAnnotations;
116119

120+
private IMetaInfo cleanupMetaInfo;
121+
117122
/**
118123
* Check if page annotations will be processed
119124
* Default: True
@@ -147,10 +152,6 @@ public void setProcessAnnotations(boolean processAnnotations) {
147152

148153
private FilteredImagesCache filteredImagesCache;
149154

150-
private static final String PRODUCT_NAME = "pdfSweep";
151-
private static final int PRODUCT_MAJOR = 1;
152-
private static final int PRODUCT_MINOR = 0;
153-
154155
/**
155156
* Creates a {@link PdfCleanUpTool} object. No regions for erasing are specified.
156157
* Use {@link PdfCleanUpTool#addCleanupLocation(PdfCleanUpLocation)} method
@@ -251,6 +252,18 @@ public PdfCleanUpTool addCleanupLocation(PdfCleanUpLocation cleanUpLocation) {
251252
return this;
252253
}
253254

255+
/**
256+
* Sets the cleanup meta info that will be passed to the {@link com.itextpdf.kernel.counter.EventCounter}
257+
* with {@link PdfSweepEvent} and can be used to determine event origin.
258+
*
259+
* @param metaInfo the meta info to set.
260+
* @return this instance
261+
*/
262+
public PdfCleanUpTool setEventCountingMetaInfo(IMetaInfo metaInfo) {
263+
this.cleanupMetaInfo = metaInfo;
264+
return this;
265+
}
266+
254267
/**
255268
* Cleans the document by erasing all the areas which are either provided or
256269
* extracted from redaction annotations.
@@ -266,6 +279,7 @@ public void cleanUp() throws IOException {
266279
removeRedactAnnots();
267280
}
268281
pdfCleanUpLocations.clear();
282+
EventCounterHandler.getInstance().onEvent(PdfSweepEvent.CLEANUP, cleanupMetaInfo, getClass());
269283
}
270284

271285
/**

‎src/main/java/com/itextpdf/pdfcleanup/PdfCleanupProductInfo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
This file is part of the iText (R) project.
3-
Copyright (c) 1998-2017 iText Group NV
3+
Copyright (c) 1998-2018 iText Group NV
44
Authors: Bruno Lowagie, Paulo Soares, et al.
55
66
This program is free software; you can redistribute it and/or modify

‎src/main/java/com/itextpdf/pdfcleanup/TextPositioning.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
This file is part of the iText (R) project.
3-
Copyright (c) 1998-2017 iText Group NV
3+
Copyright (c) 1998-2018 iText Group NV
44
Authors: iText Software.
55
66
This program is free software; you can redistribute it and/or modify

‎src/main/java/com/itextpdf/pdfcleanup/autosweep/CommonRegex.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
This file is part of the iText (R) project.
3-
Copyright (c) 1998-2017 iText Group NV
3+
Copyright (c) 1998-2018 iText Group NV
44
Authors: iText Software.
55
66
This program is free software; you can redistribute it and/or modify

‎src/main/java/com/itextpdf/pdfcleanup/autosweep/CompositeCleanupStrategy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
This file is part of the iText (R) project.
3-
Copyright (c) 1998-2017 iText Group NV
3+
Copyright (c) 1998-2018 iText Group NV
44
Authors: iText Software.
55
66
This program is free software; you can redistribute it and/or modify

‎src/main/java/com/itextpdf/pdfcleanup/autosweep/ICleanupStrategy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
This file is part of the iText (R) project.
3-
Copyright (c) 1998-2017 iText Group NV
3+
Copyright (c) 1998-2018 iText Group NV
44
Authors: iText Software.
55
66
This program is free software; you can redistribute it and/or modify

‎src/main/java/com/itextpdf/pdfcleanup/autosweep/PdfAutoSweep.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
This file is part of the iText (R) project.
3-
Copyright (c) 1998-2017 iText Group NV
3+
Copyright (c) 1998-2018 iText Group NV
44
Authors: iText Software.
55
66
This program is free software; you can redistribute it and/or modify
@@ -42,6 +42,7 @@ This file is part of the iText (R) project.
4242
*/
4343
package com.itextpdf.pdfcleanup.autosweep;
4444

45+
import com.itextpdf.io.util.SystemUtil;
4546
import com.itextpdf.kernel.geom.Rectangle;
4647
import com.itextpdf.kernel.pdf.PdfArray;
4748
import com.itextpdf.kernel.pdf.PdfDocument;
@@ -226,7 +227,7 @@ public void tentativeCleanUp(PdfPage pdfPage) {
226227
List<PdfCleanUpLocation> cleanUpLocations = getPdfCleanUpLocations(pdfPage);
227228

228229
// random title generation
229-
Random rnd = new Random(System.currentTimeMillis());
230+
Random rnd = new Random(SystemUtil.getTimeBasedSeed());
230231
Set<String> usedTitles = new HashSet<>();
231232

232233
for (PdfCleanUpLocation loc : cleanUpLocations) {

‎src/main/java/com/itextpdf/pdfcleanup/autosweep/RegexBasedCleanupStrategy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
This file is part of the iText (R) project.
3-
Copyright (c) 1998-2017 iText Group NV
3+
Copyright (c) 1998-2018 iText Group NV
44
Authors: iText Software.
55
66
This program is free software; you can redistribute it and/or modify
@@ -78,6 +78,6 @@ public RegexBasedCleanupStrategy setRedactionColor(Color color) {
7878
}
7979

8080
public ICleanupStrategy reset() {
81-
return new RegexBasedCleanupStrategy(pattern);
81+
return new RegexBasedCleanupStrategy(pattern).setRedactionColor(redactionColor);
8282
}
8383
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*
2+
3+
This file is part of the iText (R) project.
4+
Copyright (c) 1998-2018 iText Group NV
5+
Authors: Bruno Lowagie, Paulo Soares, et al.
6+
7+
This program is free software; you can redistribute it and/or modify
8+
it under the terms of the GNU Affero General Public License version 3
9+
as published by the Free Software Foundation with the addition of the
10+
following permission added to Section 15 as permitted in Section 7(a):
11+
FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY
12+
ITEXT GROUP. ITEXT GROUP DISCLAIMS THE WARRANTY OF NON INFRINGEMENT
13+
OF THIRD PARTY RIGHTS
14+
15+
This program is distributed in the hope that it will be useful, but
16+
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17+
or FITNESS FOR A PARTICULAR PURPOSE.
18+
See the GNU Affero General Public License for more details.
19+
You should have received a copy of the GNU Affero General Public License
20+
along with this program; if not, see http://www.gnu.org/licenses or write to
21+
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22+
Boston, MA, 02110-1301 USA, or download the license from the following URL:
23+
http://itextpdf.com/terms-of-use/
24+
25+
The interactive user interfaces in modified source and object code versions
26+
of this program must display Appropriate Legal Notices, as required under
27+
Section 5 of the GNU Affero General Public License.
28+
29+
In accordance with Section 7(b) of the GNU Affero General Public License,
30+
a covered work must retain the producer line in every PDF that is created
31+
or manipulated using iText.
32+
33+
You can be released from the requirements of the license by purchasing
34+
a commercial license. Buying such a license is mandatory as soon as you
35+
develop commercial activities involving the iText software without
36+
disclosing the source code of your own applications.
37+
These activities include: offering paid services to customers as an ASP,
38+
serving PDFs on the fly in a web application, shipping iText with a closed
39+
source product.
40+
41+
For more information, please contact iText Software Corp. at this
42+
address: sales@itextpdf.com
43+
*/
44+
package com.itextpdf.pdfcleanup.events;
45+
46+
import com.itextpdf.kernel.counter.NamespaceConstant;
47+
import com.itextpdf.kernel.counter.event.IGenericEvent;
48+
49+
public class PdfSweepEvent implements IGenericEvent {
50+
51+
public static final PdfSweepEvent CLEANUP = new PdfSweepEvent("cleanup");
52+
53+
private final String subtype;
54+
55+
private PdfSweepEvent(String subtype) {
56+
this.subtype = subtype;
57+
}
58+
59+
@Override
60+
public String getEventType() {
61+
return "sweep-" + subtype;
62+
}
63+
64+
@Override
65+
public String getOriginId() {
66+
return NamespaceConstant.PDF_SWEEP;
67+
}
68+
}

0 commit comments

Comments
 (0)
Please sign in to comment.