Skip to content

Commit 336705d

Browse files
committed
[RELEASE] iText 7 pdfSweep 3.0.1
2 parents e8d44ab + 8ca1792 commit 336705d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+135
-61
lines changed

pom.xml

Lines changed: 3 additions & 3 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>7.2.0</version>
8+
<version>7.2.3</version>
99
<relativePath />
1010
</parent>
1111

1212
<artifactId>cleanup</artifactId>
13-
<version>3.0.0</version>
13+
<version>3.0.1</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 they
@@ -52,7 +52,7 @@
5252
<dependency>
5353
<groupId>org.apache.commons</groupId>
5454
<artifactId>commons-imaging</artifactId>
55-
<version>1.0-SNAPSHOT</version>
55+
<version>1.0-alpha1</version>
5656
</dependency>
5757
<dependency>
5858
<groupId>com.itextpdf</groupId>

src/main/java/com/itextpdf/pdfcleanup/CleanUpProperties.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-2021 iText Group NV
3+
Copyright (c) 1998-2022 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/FilteredImagesCache.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-2021 iText Group NV
3+
Copyright (c) 1998-2022 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/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-2021 iText Group NV
3+
Copyright (c) 1998-2022 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: 10 additions & 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-2021 iText Group NV
3+
Copyright (c) 1998-2022 iText Group NV
44
Authors: iText Software.
55
66
This program is free software; you can redistribute it and/or modify
@@ -55,13 +55,19 @@ This file is part of the iText (R) project.
5555
import java.util.List;
5656
import java.util.Set;
5757

58+
/**
59+
* An event listener which handles cleanup related events.
60+
*/
5861
public class PdfCleanUpEventListener implements IEventListener {
5962
private static final String textDataExpected = "Text data expected.";
6063
private static final String imageDataExpected = "Image data expected.";
6164
private static final String pathDataExpected = "Path data expected.";
6265

6366
private List<IEventData> content = new ArrayList<>();
6467

68+
/**
69+
* {@inheritDoc}
70+
*/
6571
@Override
6672
public void eventOccurred(IEventData data, EventType type) {
6773
switch (type) {
@@ -134,6 +140,9 @@ PathRenderInfo getEncounteredPath() {
134140

135141
}
136142

143+
/**
144+
* {@inheritDoc}
145+
*/
137146
@Override
138147
public Set<EventType> getSupportedEvents() {
139148
return null;

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-2021 iText Group NV
3+
Copyright (c) 1998-2022 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-2021 iText Group NV
3+
Copyright (c) 1998-2022 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: 4 additions & 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-2021 iText Group NV
3+
Copyright (c) 1998-2022 iText Group NV
44
Authors: iText Software.
55
66
This program is free software; you can redistribute it and/or modify
@@ -106,6 +106,9 @@ This file is part of the iText (R) project.
106106
import org.slf4j.Logger;
107107
import org.slf4j.LoggerFactory;
108108

109+
/**
110+
* PDF content stream processor, which filters content to be cleaned up.
111+
*/
109112
public class PdfCleanUpProcessor extends PdfCanvasProcessor {
110113

111114
private static final Set<String> TEXT_SHOWING_OPERATORS = Collections.unmodifiableSet(new HashSet<String>(

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

Lines changed: 9 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-2021 iText Group NV
3+
Copyright (c) 1998-2022 iText Group NV
44
Authors: iText Software.
55
66
This program is free software; you can redistribute it and/or modify
@@ -183,6 +183,13 @@ public PdfCleanUpTool(PdfDocument pdfDocument, List<PdfCleanUpLocation> cleanUpL
183183
}
184184
}
185185

186+
/**
187+
* Adds a {@link PdfCleanUpLocation} to be cleaned up.
188+
*
189+
* @param cleanUpLocation a {@link PdfCleanUpLocation} to be cleaned up
190+
*
191+
* @return this {@link PdfCleanUpTool}
192+
*/
186193
public PdfCleanUpTool addCleanupLocation(PdfCleanUpLocation cleanUpLocation) {
187194
List<PdfCleanUpLocation> pgLocations = this.pdfCleanUpLocations.get(cleanUpLocation.getPage());
188195
if (pgLocations == null) {
@@ -362,7 +369,7 @@ private List<Rectangle> translateQuadPointsToRectangles(PdfArray quadPoints) {
362369
* Remove the redaction annotations.
363370
* This method is called after the annotations are processed.
364371
*
365-
* @throws IOException
372+
* @throws IOException signals that an I/O exception has occurred during redaction.
366373
*/
367374
private void removeRedactAnnots() throws IOException {
368375
for (PdfRedactAnnotation annotation : redactAnnotations.keySet()) {

src/main/java/com/itextpdf/pdfcleanup/PdfCleaner.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-2021 iText Group NV
3+
Copyright (c) 1998-2022 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/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-2021 iText Group NV
3+
Copyright (c) 1998-2022 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/actions/data/PdfSweepProductData.java

Lines changed: 3 additions & 3 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-2021 iText Group NV
3+
Copyright (c) 1998-2022 iText Group NV
44
Authors: iText Software.
55
66
This program is free software; you can redistribute it and/or modify
@@ -51,9 +51,9 @@ public class PdfSweepProductData {
5151
public static final String PDF_SWEEP_PRODUCT_NAME = "pdfSweep";
5252
public static final String PDF_SWEEP_PUBLIC_PRODUCT_NAME = PDF_SWEEP_PRODUCT_NAME;
5353

54-
private static final String PDF_SWEEP_VERSION = "3.0.0";
54+
private static final String PDF_SWEEP_VERSION = "3.0.1";
5555
private static final int PDF_SWEEP_COPYRIGHT_SINCE = 2000;
56-
private static final int PDF_SWEEP_COPYRIGHT_TO = 2021;
56+
private static final int PDF_SWEEP_COPYRIGHT_TO = 2022;
5757

5858
private static final ProductData PDF_SWEEP_PRODUCT_DATA = new ProductData(PDF_SWEEP_PUBLIC_PRODUCT_NAME,
5959
PDF_SWEEP_PRODUCT_NAME, PDF_SWEEP_VERSION, PDF_SWEEP_COPYRIGHT_SINCE, PDF_SWEEP_COPYRIGHT_TO);

src/main/java/com/itextpdf/pdfcleanup/actions/event/PdfSweepProductEvent.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-2021 iText Group NV
3+
Copyright (c) 1998-2022 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-2021 iText Group NV
3+
Copyright (c) 1998-2022 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: 39 additions & 12 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-2021 iText Group NV
3+
Copyright (c) 1998-2022 iText Group NV
44
Authors: iText Software.
55
66
This program is free software; you can redistribute it and/or modify
@@ -62,21 +62,33 @@ This file is part of the iText (R) project.
6262

6363

6464
/**
65-
* This class is a composite pattern for {@code ICleanupStrategy}
65+
* This class is a composite pattern for {@link ICleanupStrategy}.
6666
* It allows users to have multiple ICleanupStrategy implementations and bundle them as one.
6767
*/
6868
public class CompositeCleanupStrategy implements ICleanupStrategy {
6969

7070
private Map<Integer, Set<IPdfTextLocation>> locations = new HashMap<>();
7171
private List<ICleanupStrategy> strategies = new ArrayList<>();
7272

73+
/**
74+
* Creates a {@link CompositeCleanupStrategy composite pattern} for {@link ICleanupStrategy cleanup strategies}.
75+
*/
7376
public CompositeCleanupStrategy() {
7477
}
7578

76-
public void add(ICleanupStrategy ies) {
77-
strategies.add(ies);
79+
/**
80+
* Adds a {@link ICleanupStrategy cleanup strategy} to this {@link CompositeCleanupStrategy composite pattern}.
81+
*
82+
* @param strategy a {@link ICleanupStrategy cleanup strategy} to be added to this
83+
* {@link CompositeCleanupStrategy composite pattern}.
84+
*/
85+
public void add(ICleanupStrategy strategy) {
86+
strategies.add(strategy);
7887
}
7988

89+
/**
90+
* {@inheritDoc}
91+
*/
8092
@Override
8193
public Collection<IPdfTextLocation> getResultantLocations() {
8294
locations.clear();
@@ -104,10 +116,12 @@ public int compare(IPdfTextLocation l1, IPdfTextLocation l2) {
104116
}
105117
});
106118

107-
// return
108119
return rectangles;
109120
}
110121

122+
/**
123+
* {@inheritDoc}
124+
*/
111125
@Override
112126
public Color getRedactionColor(IPdfTextLocation location) {
113127
for (int i = 0; i < strategies.size(); i++) {
@@ -118,13 +132,19 @@ public Color getRedactionColor(IPdfTextLocation location) {
118132
return ColorConstants.BLACK;
119133
}
120134

135+
/**
136+
* {@inheritDoc}
137+
*/
121138
@Override
122139
public void eventOccurred(IEventData data, EventType type) {
123140
for (ILocationExtractionStrategy s : strategies) {
124141
s.eventOccurred(data, type);
125142
}
126143
}
127144

145+
/**
146+
* {@inheritDoc}
147+
*/
128148
@Override
129149
public Set<EventType> getSupportedEvents() {
130150
Set<EventType> evts = new HashSet<>();
@@ -136,13 +156,20 @@ public Set<EventType> getSupportedEvents() {
136156
return evts.isEmpty() ? null : evts;
137157
}
138158

139-
public ICleanupStrategy reset()
140-
{
141-
CompositeCleanupStrategy retval = new CompositeCleanupStrategy();
142-
for(ICleanupStrategy s : strategies)
143-
{
144-
retval.add(s.reset());
159+
/**
160+
* Returns a {@link ICleanupStrategy cleanup strategy} which represents
161+
* a reset {@link CompositeCleanupStrategy composite cleanup strategy}.
162+
*
163+
* <p>
164+
* Note that all the inner {@link ICleanupStrategy strategies} will be reset as well.
165+
*
166+
* @return a reset {@link CompositeCleanupStrategy composite strategy}
167+
*/
168+
public ICleanupStrategy reset() {
169+
CompositeCleanupStrategy resetCompositeStrategy = new CompositeCleanupStrategy();
170+
for(ICleanupStrategy s : strategies) {
171+
resetCompositeStrategy.add(s.reset());
145172
}
146-
return retval;
173+
return resetCompositeStrategy;
147174
}
148175
}

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-2021 iText Group NV
3+
Copyright (c) 1998-2022 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/PdfAutoSweepTools.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-2021 iText Group NV
3+
Copyright (c) 1998-2022 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/RegexBasedCleanupStrategy.java

Lines changed: 26 additions & 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-2021 iText Group NV
3+
Copyright (c) 1998-2022 iText Group NV
44
Authors: iText Software.
55
66
This program is free software; you can redistribute it and/or modify
@@ -57,26 +57,51 @@ public class RegexBasedCleanupStrategy extends RegexBasedLocationExtractionStrat
5757
private Pattern pattern;
5858
private Color redactionColor = ColorConstants.BLACK;
5959

60+
/**
61+
* Creates an object of regular expression based cleanup strategy.
62+
*
63+
* @param regex regular expression on which cleanup strategy will be based
64+
*/
6065
public RegexBasedCleanupStrategy(String regex) {
6166
super(regex);
6267
this.pattern = Pattern.compile(regex);
6368
}
6469

70+
/**
71+
* Creates an object of regular expression based cleanup strategy.
72+
*
73+
* @param pattern {@link Pattern} pattern on which cleanup strategy will be based
74+
*/
6575
public RegexBasedCleanupStrategy(Pattern pattern) {
6676
super(pattern);
6777
this.pattern = pattern;
6878
}
6979

80+
/**
81+
* {@inheritDoc}
82+
*/
7083
@Override
7184
public Color getRedactionColor(IPdfTextLocation location) {
7285
return redactionColor;
7386
}
7487

88+
/**
89+
* Sets the color in which redaction is to take place.
90+
*
91+
* @param color the color in which redaction is to take place
92+
*
93+
* @return this {@link RegexBasedCleanupStrategy strategy}
94+
*/
7595
public RegexBasedCleanupStrategy setRedactionColor(Color color) {
7696
this.redactionColor = color;
7797
return this;
7898
}
7999

100+
/**
101+
* Returns an {@link ICleanupStrategy} object which is set to this regular pattern and redaction color.
102+
*
103+
* @return a reset {@link ICleanupStrategy cleanup strategy}
104+
*/
80105
public ICleanupStrategy reset() {
81106
return new RegexBasedCleanupStrategy(pattern).setRedactionColor(redactionColor);
82107
}

src/main/java/com/itextpdf/pdfcleanup/exceptions/CleanupExceptionMessageConstant.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-2021 iText Group NV
3+
Copyright (c) 1998-2022 iText Group NV
44
Authors: iText Software.
55
66
This program is offered under a commercial and under the AGPL license.

0 commit comments

Comments
 (0)