Skip to content

Commit 543f808

Browse files
committed
[RELEASE] iText pdfSweep 5.0.0
2 parents 524c8ed + e0e4a8d commit 543f808

16 files changed

+460
-92
lines changed

SECURITY.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# iText Security Policy
2+
3+
## Reporting a Vulnerability
4+
5+
We are committed to maintaining the security of our software. If you discover a security vulnerability, we encourage you to report it to us as soon as possible.
6+
7+
To report a vulnerability, please visit our [Vulnerability Reporting Page](https://itextpdf.com/report-vulnerability), or email [[email protected]]([email protected]). If you do not receive a response in 2 business days, please follow up as we may not have received your message.
8+
9+
We follow the procedure of Coordinated Vulnerability Disclosure (CVD) and, to protect the ecosystem, we request that those reporting do the same. Please visit the above page for more information, and follow the steps below to ensure that your report is handled promptly and appropriately:
10+
11+
1. **Do not disclose the vulnerability publicly** until we have had a chance to address it.
12+
2. **Provide a detailed description** of the vulnerability, including steps to reproduce it, if possible.
13+
3. **Include any relevant information** such as the version of pdfSweep you are using, your operating system, and any other pertinent details.
14+
15+
## Security Updates and Patches
16+
17+
When a vulnerability is reported, we will:
18+
19+
1. **Investigate and verify** the vulnerability.
20+
2. **Develop and test** a fix for the vulnerability.
21+
3. **Release a patch** as soon as possible.
22+
23+
## Known Vulnerabilities
24+
25+
The iText Knowledge Base has a page for known [Common Vulnerabilities and Exposures](https://kb.itextpdf.com/itext/cves) (CVEs), please check it to ensure your vulnerability has not already been disclosed or addressed.
26+
27+
## Supported product lines
28+
29+
See [Compatibility Matrix](https://kb.itextpdf.com/itext/compatibility-matrix)
30+
31+
## Security Best Practices
32+
33+
To help ensure the security of your applications using pdfSweep, we recommend the following best practices:
34+
35+
1. **Keep pdfSweep up to date** by regularly checking for and applying updates.
36+
2. **Review and follow** our security guidelines for secure usage.
37+
3. **Monitor your applications** for any unusual activity and investigate any anomalies promptly.
38+
39+
Thank you for helping us keep iText secure!

pom.xml

Lines changed: 2 additions & 2 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>8.0.5</version>
8+
<version>9.0.0</version>
99
<relativePath />
1010
</parent>
1111

1212
<artifactId>cleanup</artifactId>
13-
<version>4.0.3</version>
13+
<version>5.0.0</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

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

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public class CleanUpProperties {
3333
private IMetaInfo metaInfo;
3434
private boolean processAnnotations;
3535
private Double overlapRatio;
36+
private PathOffsetApproximationProperties offsetProperties = new PathOffsetApproximationProperties();
3637

3738
/**
3839
* Creates default CleanUpProperties instance.
@@ -54,9 +55,12 @@ IMetaInfo getMetaInfo() {
5455
* Sets additional meta info.
5556
*
5657
* @param metaInfo the meta info to set
58+
*
59+
* @return this {@link CleanUpProperties} instance
5760
*/
58-
public void setMetaInfo(IMetaInfo metaInfo) {
61+
public CleanUpProperties setMetaInfo(IMetaInfo metaInfo) {
5962
this.metaInfo = metaInfo;
63+
return this;
6064
}
6165

6266
/**
@@ -74,9 +78,12 @@ public boolean isProcessAnnotations() {
7478
* Default processing behaviour: remove annotation if there is overlap with a redaction region.
7579
*
7680
* @param processAnnotations is page annotations will be processed
81+
*
82+
* @return this {@link CleanUpProperties} instance
7783
*/
78-
public void setProcessAnnotations(boolean processAnnotations) {
84+
public CleanUpProperties setProcessAnnotations(boolean processAnnotations) {
7985
this.processAnnotations = processAnnotations;
86+
return this;
8087
}
8188

8289
/**
@@ -98,16 +105,42 @@ public Double getOverlapRatio() {
98105
* Example: if the overlap ratio is set to 0.3, the content region will be removed if it overlaps with
99106
* the redaction area by at least 30%.
100107
*
101-
* @param overlapRatio The overlap ratio to set.
108+
* @param overlapRatio the overlap ratio to set
109+
*
110+
* @return this {@link CleanUpProperties} instance
102111
*/
103-
public void setOverlapRatio(Double overlapRatio) {
112+
public CleanUpProperties setOverlapRatio(Double overlapRatio) {
104113
if (overlapRatio == null) {
105114
this.overlapRatio = null;
106-
return;
115+
return this;
107116
}
108117
if (overlapRatio <= 0 || overlapRatio > 1) {
109118
throw new IllegalArgumentException(CleanupExceptionMessageConstant.OVERLAP_RATIO_SHOULD_BE_IN_RANGE);
110119
}
111120
this.overlapRatio = overlapRatio;
121+
return this;
122+
}
123+
124+
/**
125+
* Get {@link PathOffsetApproximationProperties} specifying approximation parameters for
126+
* {@link com.itextpdf.kernel.pdf.canvas.parser.clipper.ClipperOffset} operations.
127+
*
128+
* @return {@link PathOffsetApproximationProperties} parameters
129+
*/
130+
public PathOffsetApproximationProperties getOffsetProperties() {
131+
return offsetProperties;
132+
}
133+
134+
/**
135+
* Set {@link PathOffsetApproximationProperties} specifying approximation parameters for
136+
* {@link com.itextpdf.kernel.pdf.canvas.parser.clipper.ClipperOffset} operations.
137+
*
138+
* @param offsetProperties {@link PathOffsetApproximationProperties} to set
139+
*
140+
* @return this {@link CleanUpProperties} instance
141+
*/
142+
public CleanUpProperties setOffsetProperties(PathOffsetApproximationProperties offsetProperties) {
143+
this.offsetProperties = offsetProperties;
144+
return this;
112145
}
113146
}
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
/*
2+
This file is part of the iText (R) project.
3+
Copyright (c) 1998-2024 Apryse Group NV
4+
Authors: Apryse Software.
5+
6+
This program is offered under a commercial and under the AGPL license.
7+
For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below.
8+
9+
AGPL licensing:
10+
This program is free software: you can redistribute it and/or modify
11+
it under the terms of the GNU Affero General Public License as published by
12+
the Free Software Foundation, either version 3 of the License, or
13+
(at your option) any later version.
14+
15+
This program is distributed in the hope that it will be useful,
16+
but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
GNU Affero General Public License for more details.
19+
20+
You should have received a copy of the GNU Affero General Public License
21+
along with this program. If not, see <https://www.gnu.org/licenses/>.
22+
*/
23+
package com.itextpdf.pdfcleanup;
24+
25+
import com.itextpdf.kernel.pdf.canvas.parser.clipper.ClipperBridge;
26+
27+
/**
28+
* Contains properties for {@link com.itextpdf.kernel.pdf.canvas.parser.clipper.ClipperOffset} operations.
29+
*/
30+
public class PathOffsetApproximationProperties {
31+
private double arcTolerance = 0.0025;
32+
private boolean calculateOffsetMultiplierDynamically = false;
33+
34+
/**
35+
* Creates new {@link PathOffsetApproximationProperties} instance.
36+
*/
37+
public PathOffsetApproximationProperties() {
38+
// Empty constructor.
39+
}
40+
41+
/**
42+
* Specifies if floatMultiplier should be calculated dynamically. Default value is {@code false}.
43+
*
44+
* <p>
45+
* When a document with line arts is being cleaned up, there are a lot of calculations with floating point numbers.
46+
* All of them are translated into fixed point numbers by multiplying by this floatMultiplier coefficient.
47+
* It is possible to dynamically adjust the preciseness of the calculations.
48+
*
49+
* @param calculateDynamically {@code true} if floatMultiplier should be calculated dynamically,
50+
* {@code false} for default value specified by {@link ClipperBridge#ClipperBridge()}
51+
*
52+
* @return this {@link PathOffsetApproximationProperties} instance
53+
*/
54+
public PathOffsetApproximationProperties calculateOffsetMultiplierDynamically(boolean calculateDynamically) {
55+
this.calculateOffsetMultiplierDynamically = calculateDynamically;
56+
return this;
57+
}
58+
59+
/**
60+
* Checks whether floatMultiplier should be calculated dynamically.
61+
*
62+
* <p>
63+
* When a document with line arts is being cleaned up, there are a lot of calculations with floating point numbers.
64+
* All of them are translated into fixed point numbers by multiplying by this floatMultiplier coefficient.
65+
* It is possible to dynamically adjust the preciseness of the calculations.
66+
*
67+
* @return {@code true} if floatMultiplier should be calculated dynamically, {@code false} for default value
68+
*/
69+
public boolean calculateOffsetMultiplierDynamically() {
70+
return this.calculateOffsetMultiplierDynamically;
71+
}
72+
73+
/**
74+
* Gets arc tolerance which is the maximum difference between the true and the faceted representation of curves
75+
* (arcs) in units. Used as the criterion of a good approximation of rounded line joins and line caps.
76+
*
77+
* <p>
78+
* Since flattened paths can never perfectly represent arcs, this field/property specifies a maximum acceptable
79+
* imprecision (tolerance) when arcs are approximated in an offsetting operation. Smaller values will increase
80+
* smoothness up to a point though at a cost of performance and in creating more vertices to construct the arc.
81+
*
82+
* @return arc tolerance specifying maximum difference between the true and the faceted representation of arcs
83+
*/
84+
public double getArcTolerance() {
85+
return arcTolerance;
86+
}
87+
88+
/**
89+
* Sets arc tolerance which is the maximum difference between the true and the faceted representation of curves
90+
* (arcs) in units. Used as the criterion of a good approximation of rounded line joins and line caps.
91+
*
92+
* <p>
93+
* Since flattened paths can never perfectly represent arcs, this field/property specifies a maximum acceptable
94+
* imprecision (tolerance) when arcs are approximated in an offsetting operation. Smaller values will increase
95+
* smoothness up to a point though at a cost of performance and in creating more vertices to construct the arc.
96+
*
97+
* @param arcTolerance maximum difference between the true and the faceted representation of arcs
98+
*
99+
* @return this {@link PathOffsetApproximationProperties} instance
100+
*/
101+
public PathOffsetApproximationProperties setArcTolerance(double arcTolerance) {
102+
this.arcTolerance = arcTolerance;
103+
return this;
104+
}
105+
}

0 commit comments

Comments
 (0)