Skip to content

Commit 1fa00c6

Browse files
committed
[RELEASE] iText 7 Core - 7.1.14
https://github.com/itext/itext7/releases/tag/7.1.14 * release/7.1.14: [RELEASE] 7.1.14 Add unit tests for SvgCoordinateUtils Clean up manual porting for java's Matcher Restore lost tests introduced in DEVSIX-4682 Support 'patternTransform' attribute for SVG pattern element Add support to utf-8 image format in svg Support 'viewbox' and `preserveAspectRatio' attribute for SVG pattern element Add test on second time signing document Add tests for SVG moveTo followed by multiple pairs Refactor text renderers sequence word wrapping logic Separate text sequence reset logic for robustness Support overflow-wrap: break-word/anywhere in case of the not fitting single glyph Remove floats skipping logic in span-wrapping: now floats break text sequence Support word-break property Support minMaxWidth counting for span- and special scripts wrapping Change condition to stop TextRenderer#layout when a width limit is reached Text elements wrapping support Add missing copyright headers Fix dummy log messages when we are processing xlink href with data Improve test coverage for StopSvgNodeRenderer class Add missing copyright headers Add PdfObjectReleaseTest class Add tests with all options of preserveAspectRation in svg element Add missing copyright headers Add tests with relative units in attributes of svg elements Add tests for absolutely positioned elements added to Canvas Fix javadoc Add stroke-width into inheritable set of svg attributes, update cmp files Upgrade BouncyCastle version to 1.67 Fix javadoc warnings Add KeepTogetherTest#keepTogetherInDivWithKidsFloatTest Support 'objectBoundingBox' value for SVG pattern element 'patternContentUnits' and 'patternUnits' Unify the resource folder for HighlightItemsTest class Add form field borders support Add JavaDocs to unsupported AreaBreakRenderer methods Add support of pages target-counter(s). Finalize whole target-counter logic Add missing copyright headers Implement non-page(s) target-counter(s) Matcher tests Add initial support of SVG pattern element Configure dependency-check-maven to connect to a central database Support overflow-x for special scripts Support css overflow-wrap property Update veraPDF version in pdftest module Update printed links in CompareTool Update CONTRIBUTING.md with latest information and links Update BouncyCastle version to 1.66 Divide the CssUtils class into several classes Move HighlightItemsTest from samples-internal repository Update slf4j version from 1.7.13 to 1.7.30 Delete TODO related to clossed ticket Add intergration tests reproducing keep-together causing content overlap Make mutable final sets unmodifable Add XXEVulnerabilityTest class Add new tests for PdfTextExtractor Speed up PdfPagesTest#randomNumberPagesTest() Add missing copyright headers Implement target-counter for page Revert "Update junit version" Update junit version Update Java version from 1.7 to 1.8 Remove TODO related to closed DEVSIX-2785 Get rid of TODOs not related to Jira tickets in SignatureUtil BlockRenderer keep together for clear child element fix Add tests for keep-together elements in collaboration with floats wrapped into non-floating element Add intedration tests for svg pattern element Add missing copyright headers Add support of font-relative units for the font-size property Fix NPE in CanvasTag#getActualText() in case properties are missing Improve javadocs in svg and xml-parser modules Update japicmp version to 0.14.4 Add missing copyright headers Improving test coverage for PdfFont class Fix javadoc warnings Remove package-info.java Fix JavaDoc warnings in several classes Fix javadoc warnings in PdfExplicitDestination and in PdfExplicitRemoteGoToDestination Remove itext5 verison tag from root pom file [AFTER RELEASE] 7.1.13 Allow fetching of OTF language records by tag Add tests on default font-size and inheritance inside TSpan element Add missing copyright headers Fix overflow in OTF readCoverageFormat() DEVSIX-4642
2 parents f5b3c77 + b027d34 commit 1fa00c6

File tree

628 files changed

+14627
-2135
lines changed

Some content is hidden

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

628 files changed

+14627
-2135
lines changed

CONTRIBUTING.md

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ Before you submit your pull request consider the following guidelines:
6868
* Verify that your proposed change hasn't already been addressed in the develop branch.
6969
* Don't send a separate pull request for every single file you change.
7070
* Please sign the [iText Contributor License Agreement (iCLA)](#cla) before sending pull
71-
requests for any change of more than 20 significant lines of code (we're not counting curly braces and other syntactical sugar).
72-
We cannot accept code without this agreement.
71+
requests. We cannot accept code without this agreement.
7372
* Fork the iText repository on GitHub.
7473
* Clone your iText fork to your local machine.
7574
* Make your changes, **including appropriate test cases**.
@@ -100,8 +99,7 @@ To ensure consistency throughout the source code, keep these rules in mind as yo
10099

101100
* We develop in Java first, and then port to .NET, so code submissions in Java are preferred.
102101
Nevertheless this shouldn't stop you from making a good pull request to the .NET port.
103-
* All Java code **must** be Java 7. Sorry, no lambda expressions or other Java 8 language features.
104-
* All features or bug fixes **must be tested** by one or more [unit tests][unit-testing].
102+
* All features or bug fixes **must be tested** by one or more unit tests.
105103
* All public API methods **must be documented** with JavaDoc. To see how we document our APIs, please check
106104
out the existing [javadocs][javadocs].
107105
* We follow the rules contained in
@@ -151,8 +149,7 @@ reference JIRA or GitHub issues that this commit **Closes**.
151149

152150
## <a name="cla">Signing the iCLA</a>
153151

154-
Please sign the **iText Contributor License Agreement (iCLA)** before sending pull requests. For any larger code
155-
changes (more than 20 lines of significant code) to be accepted, the iCLA must be signed. It's a quick process, we promise!
152+
Please sign the [**iText Contributor License Agreement (iCLA)**][cla] before sending pull requests. For any code changes to be accepted, the iCLA must be signed. It's a quick process, we promise!
156153

157154
We'll need you to [(digitally) sign and then email, fax or mail the form][cla].
158155

@@ -165,18 +162,17 @@ We use the [Stack Exchange][stackoverflow] network for free support and [GitHub]
165162
* StackExchange: [http://stackexchange.com/legal](http://stackexchange.com/legal)
166163
* Github: [https://help.github.com/articles/github-terms-of-service/](https://help.github.com/articles/github-terms-of-service/)
167164

168-
[cla]: http://itextpdf.com/policy
165+
[cla]: https://itextpdf.com/en/how-buy/legal/itext-contributor-license-agreement
169166
[coc]: CODE_OF_CONDUCT.md
170167
[github]: https://github.com/itext/itext7
171-
[java-style-guide]: http://www.oracle.com/technetwork/java/codeconvtoc-136057.html
172-
[javadocs]: http://itextpdf.com/api
168+
[java-style-guide]: https://www.oracle.com/technetwork/java/codeconvtoc-136057.html
169+
[javadocs]: https://itextpdf.com/api
173170
[pull]: https://github.com/itext/itext7/pulls
174171
[sscce]: http://sscce.org/
175-
[stackoverflow]: http://stackoverflow.com/questions/tagged/itext7
176-
[good-questions]: http://stackoverflow.com/help/how-to-ask
177-
[mcve]: http://stackoverflow.com/help/mcve
178-
[support]: http://itextpdf.com/support
179-
[unit-testing]: http://junit.org/
172+
[stackoverflow]: https://stackoverflow.com/questions/tagged/itext7
173+
[good-questions]: https://stackoverflow.com/help/how-to-ask
174+
[mcve]: https://stackoverflow.com/help/mcve
175+
[support]: https://itextpdf.com/support
180176
[git-commit]: https://chris.beams.io/posts/git-commit/
181177
[git-commit-separate]: https://chris.beams.io/posts/git-commit/#separate
182178
[git-commit-limit-50]: https://chris.beams.io/posts/git-commit/#limit-50

barcodes/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>com.itextpdf</groupId>
66
<artifactId>root</artifactId>
7-
<version>7.1.13</version>
7+
<version>7.1.14</version>
88
</parent>
99
<artifactId>barcodes</artifactId>
1010
<name>iText 7 - barcodes</name>

barcodes/src/main/java/com/itextpdf/barcodes/qrcode/QRCodeWriter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public final class QRCodeWriter {
6060
* @param width width of the QR-code
6161
* @param height height of the QR-code
6262
* @return 2D Greyscale map containing the visual representation of the QR-code, stored as a Bytematrix
63-
* @throws WriterException
63+
* @throws WriterException exception is thrown in case an error occurs when encoding a barcode using the Writer framework
6464
*/
6565
public ByteMatrix encode(String contents, int width, int height)
6666
throws WriterException {
@@ -76,7 +76,7 @@ public ByteMatrix encode(String contents, int width, int height)
7676
* @param height height of the QR-code
7777
* @param hints Map containing suggestions for error-correction level and version
7878
* @return 2D Greyscale map containing the visual representation of the QR-code, stored as a Bytematrix
79-
* @throws WriterException
79+
* @throws WriterException exception is thrown in case an error occurs when encoding a barcode using the Writer framework
8080
*/
8181
public ByteMatrix encode(String contents, int width, int height,
8282
Map<EncodeHintType,Object> hints) throws WriterException {

font-asian/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>com.itextpdf</groupId>
66
<artifactId>root</artifactId>
7-
<version>7.1.13</version>
7+
<version>7.1.14</version>
88
</parent>
99
<artifactId>font-asian</artifactId>
1010
<name>iText 7 - Asian fonts</name>

forms/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>com.itextpdf</groupId>
66
<artifactId>root</artifactId>
7-
<version>7.1.13</version>
7+
<version>7.1.14</version>
88
</parent>
99
<artifactId>forms</artifactId>
1010
<name>iText 7 - forms</name>

forms/src/main/java/com/itextpdf/forms/fields/PdfFormField.java

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ This file is part of the iText (R) project.
4444
package com.itextpdf.forms.fields;
4545

4646
import com.itextpdf.forms.PdfAcroForm;
47+
import com.itextpdf.forms.fields.borders.FormBorderFactory;
4748
import com.itextpdf.forms.util.DrawingUtil;
4849
import com.itextpdf.io.LogMessageConstant;
4950
import com.itextpdf.io.codec.Base64;
@@ -89,6 +90,7 @@ This file is part of the iText (R) project.
8990
import com.itextpdf.kernel.pdf.xobject.PdfImageXObject;
9091
import com.itextpdf.layout.Canvas;
9192
import com.itextpdf.layout.Style;
93+
import com.itextpdf.layout.borders.Border;
9294
import com.itextpdf.layout.element.Div;
9395
import com.itextpdf.layout.element.Paragraph;
9496
import com.itextpdf.layout.element.Text;
@@ -2058,13 +2060,7 @@ public PdfFormField setBorderWidth(float borderWidth) {
20582060
}
20592061

20602062
public PdfFormField setBorderStyle(PdfDictionary style) {
2061-
//PdfDictionary bs = getWidgets().get(0).getBorderStyle();
20622063
getWidgets().get(0).setBorderStyle(style);
2063-
// if (bs == null) {
2064-
// bs = new PdfDictionary();
2065-
// put(PdfName.BS, bs);
2066-
// }
2067-
// bs.put(PdfName.S, style);
20682064
regenerateField();
20692065
return this;
20702066
}
@@ -2670,29 +2666,27 @@ protected void drawBorder(PdfCanvas canvas, PdfFormXObject xObject, float width,
26702666
}
26712667

26722668
if (backgroundColor != null) {
2673-
canvas.
2674-
setFillColor(backgroundColor).
2675-
rectangle(0, 0, width, height).
2676-
fill();
2669+
canvas
2670+
.setFillColor(backgroundColor)
2671+
.rectangle(0, 0, width, height)
2672+
.fill();
26772673
}
26782674

26792675
if (borderWidth > 0 && borderColor != null) {
26802676
borderWidth = Math.max(1, borderWidth);
2681-
canvas.
2682-
setStrokeColor(borderColor).
2683-
setLineWidth(borderWidth);
2684-
if (bs != null) {
2685-
PdfName borderType = bs.getAsName(PdfName.S);
2686-
if (borderType != null && borderType.equals(PdfName.D)) {
2687-
PdfArray dashArray = bs.getAsArray(PdfName.D);
2688-
int unitsOn = dashArray != null ? (dashArray.size() > 0 ? (dashArray.getAsNumber(0) != null ? dashArray.getAsNumber(0).intValue() : 3) : 3) : 3;
2689-
int unitsOff = dashArray != null ? (dashArray.size() > 1 ? (dashArray.getAsNumber(1) != null ? dashArray.getAsNumber(1).intValue() : unitsOn) : unitsOn) : unitsOn;
2690-
canvas.setLineDash(unitsOn, unitsOff, 0);
2691-
}
2677+
canvas
2678+
.setStrokeColor(borderColor)
2679+
.setLineWidth(borderWidth);
2680+
Border border = FormBorderFactory.getBorder(bs, borderWidth, borderColor, backgroundColor);
2681+
if (border != null) {
2682+
float borderWidthX2 = borderWidth + borderWidth;
2683+
border.draw(canvas, new Rectangle(borderWidth, borderWidth,
2684+
width - borderWidthX2, height - borderWidthX2));
2685+
} else {
2686+
canvas
2687+
.rectangle(0, 0, width, height)
2688+
.stroke();
26922689
}
2693-
canvas.
2694-
rectangle(0, 0, width, height).
2695-
stroke();
26962690
}
26972691

26982692
applyRotation(xObject, height, width);

svg/src/main/java/com/itextpdf/svg/utils/SvgRegexUtils.java renamed to forms/src/main/java/com/itextpdf/forms/fields/borders/AbstractFormBorder.java

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/*
2+
23
This file is part of the iText (R) project.
34
Copyright (c) 1998-2020 iText Group NV
4-
Authors: iText Software.
5+
Authors: Bruno Lowagie, Paulo Soares, et al.
56
67
This program is free software; you can redistribute it and/or modify
78
it under the terms of the GNU Affero General Public License version 3
@@ -40,19 +41,33 @@ This file is part of the iText (R) project.
4041
For more information, please contact iText Software Corp. at this
4142
4243
*/
43-
package com.itextpdf.svg.utils;
44+
package com.itextpdf.forms.fields.borders;
4445

45-
import java.util.regex.Matcher;
46-
import java.util.regex.Pattern;
46+
import com.itextpdf.kernel.colors.Color;
47+
import com.itextpdf.layout.borders.Border;
4748

48-
/**
49-
* This file is a helper class for internal usage only.
50-
* Be aware that its API and functionality may be changed in future.
51-
*/
52-
public class SvgRegexUtils {
49+
abstract class AbstractFormBorder extends Border {
50+
51+
/**
52+
* The form underline border.
53+
*
54+
* @see com.itextpdf.forms.fields.borders.UnderlineBorder
55+
*/
56+
static final int FORM_UNDERLINE = 1001;
57+
/**
58+
* The form beveled border.
59+
*
60+
* @see com.itextpdf.forms.fields.borders.BeveledBorder
61+
*/
62+
static final int FORM_BEVELED = 1002;
63+
/**
64+
* The form inset border.
65+
*
66+
* @see com.itextpdf.forms.fields.borders.InsetBorder
67+
*/
68+
static final int FORM_INSET = 1003;
5369

54-
public static boolean containsAtLeastOneMatch(Pattern regexPattern, String stringToExamine){
55-
Matcher matcher = regexPattern.matcher(stringToExamine);
56-
return matcher.find();
70+
protected AbstractFormBorder(Color color, float width) {
71+
super(color, width);
5772
}
5873
}
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
/*
2+
3+
This file is part of the iText (R) project.
4+
Copyright (c) 1998-2020 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+
43+
*/
44+
package com.itextpdf.forms.fields.borders;
45+
46+
import com.itextpdf.kernel.colors.Color;
47+
import com.itextpdf.kernel.colors.ColorConstants;
48+
import com.itextpdf.kernel.colors.DeviceCmyk;
49+
import com.itextpdf.kernel.colors.DeviceGray;
50+
import com.itextpdf.kernel.colors.DeviceRgb;
51+
import com.itextpdf.kernel.pdf.canvas.PdfCanvas;
52+
import com.itextpdf.layout.borders.SolidBorder;
53+
54+
class BeveledBorder extends AbstractFormBorder {
55+
56+
private final Color backgroundColor;
57+
58+
public BeveledBorder(Color color, float width, Color backgroundColor) {
59+
super(color, width);
60+
this.backgroundColor = backgroundColor;
61+
}
62+
63+
/**
64+
* {@inheritDoc}
65+
*/
66+
@Override
67+
public void draw(PdfCanvas canvas, float x1, float y1, float x2, float y2, Side defaultSide,
68+
float borderWidthBefore, float borderWidthAfter) {
69+
SolidBorder solidBorder = new SolidBorder(getColor(), width);
70+
solidBorder.draw(canvas, x1, y1, x2, y2, defaultSide, borderWidthBefore, borderWidthAfter);
71+
float borderWidth = getWidth();
72+
float borderWidthX2 = borderWidth + borderWidth;
73+
Color darkerBackground = backgroundColor != null ? getDarkerColor(backgroundColor) : ColorConstants.LIGHT_GRAY;
74+
if (Side.TOP.equals(defaultSide)) {
75+
solidBorder = new SolidBorder(ColorConstants.WHITE, borderWidth);
76+
solidBorder.draw(canvas, borderWidthX2, y1 - borderWidth, x2 - borderWidth,
77+
y2 - borderWidth, Side.TOP, borderWidth, borderWidth);
78+
} else if (Side.BOTTOM.equals(defaultSide)) {
79+
solidBorder = new SolidBorder(darkerBackground, borderWidth);
80+
solidBorder.draw(canvas, x1 - borderWidth, borderWidthX2, borderWidthX2, borderWidthX2,
81+
Side.BOTTOM, borderWidth, borderWidth);
82+
} else if (Side.LEFT.equals(defaultSide)) {
83+
solidBorder = new SolidBorder(ColorConstants.WHITE, borderWidth);
84+
solidBorder.draw(canvas, borderWidthX2, borderWidthX2, borderWidthX2, y2 - borderWidth,
85+
Side.LEFT, borderWidth, borderWidth);
86+
} else if (Side.RIGHT.equals(defaultSide)) {
87+
solidBorder = new SolidBorder(darkerBackground, borderWidth);
88+
solidBorder.draw(canvas, x1 - borderWidth, y1 - borderWidth,
89+
x2 - borderWidth, borderWidthX2, Side.RIGHT, borderWidth, borderWidth);
90+
}
91+
}
92+
93+
/**
94+
* {@inheritDoc}
95+
*/
96+
@Override
97+
public void drawCellBorder(PdfCanvas canvas, float x1, float y1, float x2, float y2, Side defaultSide) {
98+
throw new UnsupportedOperationException();
99+
}
100+
101+
/**
102+
* {@inheritDoc}
103+
*/
104+
@Override
105+
public int getType() {
106+
return AbstractFormBorder.FORM_BEVELED;
107+
}
108+
109+
private Color getDarkerColor(Color color) {
110+
if (color instanceof DeviceRgb) {
111+
return DeviceRgb.makeDarker((DeviceRgb) color);
112+
} else if (color instanceof DeviceCmyk) {
113+
return DeviceCmyk.makeDarker((DeviceCmyk) color);
114+
} else if (color instanceof DeviceGray) {
115+
return DeviceGray.makeDarker((DeviceGray) color);
116+
} else {
117+
return color;
118+
}
119+
}
120+
}

0 commit comments

Comments
 (0)