Skip to content

Commit 91f030a

Browse files
committed
[RELEASE] Merge branch 'release/1.0.3' into HEAD
2 parents a1e49be + 55a7782 commit 91f030a

Some content is hidden

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

46 files changed

+1582
-161
lines changed

pom.xml

+58-58
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,46 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<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">
53
<modelVersion>4.0.0</modelVersion>
64

75
<parent>
86
<groupId>com.itextpdf</groupId>
97
<artifactId>root</artifactId>
10-
<version>7.0.5</version>
11-
<relativePath/>
8+
<version>7.0.6</version>
9+
<relativePath />
1210
</parent>
1311

1412
<artifactId>html2pdf</artifactId>
15-
<version>1.0.2</version>
13+
<version>1.0.3</version>
1614

1715
<name>pdfHTML</name>
1816
<description>pdfHTML is an iText 7 add-on that lets you to parse (X)HTML snippets and the associated CSS and converts
19-
them to PDF.
20-
</description>
17+
them to PDF.</description>
2118
<url>http://itextpdf.com/</url>
2219

2320
<properties>
2421
<itext.version>${project.parent.version}</itext.version>
2522
<javadoc.version>2.10.4</javadoc.version>
2623
</properties>
2724

25+
<repositories>
26+
<repository>
27+
<snapshots>
28+
<enabled>true</enabled>
29+
</snapshots>
30+
<id>itext-snapshot</id>
31+
<name>iText Repository - snapshots</name>
32+
<url>https://repo.itextsupport.com/snapshot</url>
33+
</repository>
34+
<repository>
35+
<snapshots>
36+
<enabled>false</enabled>
37+
</snapshots>
38+
<id>itext-releases</id>
39+
<name>iText Repository - releases</name>
40+
<url>https://repo.itextsupport.com/releases</url>
41+
</repository>
42+
</repositories>
43+
2844
<dependencies>
2945
<dependency>
3046
<groupId>com.itextpdf</groupId>
@@ -33,49 +49,45 @@
3349
</dependency>
3450
<dependency>
3551
<groupId>com.itextpdf</groupId>
36-
<artifactId>pdftest</artifactId>
52+
<artifactId>forms</artifactId>
3753
<version>${itext.version}</version>
38-
<scope>test</scope>
3954
</dependency>
4055
<dependency>
4156
<groupId>com.itextpdf</groupId>
42-
<artifactId>pdfa</artifactId>
57+
<artifactId>pdftest</artifactId>
4358
<version>${itext.version}</version>
4459
<scope>test</scope>
4560
</dependency>
4661
<dependency>
4762
<groupId>com.itextpdf</groupId>
48-
<artifactId>hyph</artifactId>
63+
<artifactId>pdfa</artifactId>
4964
<version>${itext.version}</version>
5065
<scope>test</scope>
5166
</dependency>
5267
<dependency>
5368
<groupId>com.itextpdf</groupId>
54-
<artifactId>forms</artifactId>
69+
<artifactId>hyph</artifactId>
5570
<version>${itext.version}</version>
71+
<scope>test</scope>
5672
</dependency>
5773
</dependencies>
5874

59-
<repositories>
60-
<repository>
61-
<id>itext-snapshot</id>
62-
<name>iText Repository - snapshots</name>
63-
<url>https://repo.itextsupport.com/snapshot</url>
64-
<snapshots>
65-
<enabled>true</enabled>
66-
</snapshots>
67-
</repository>
68-
<repository>
69-
<id>itext-releases</id>
70-
<name>iText Repository - releases</name>
71-
<url>https://repo.itextsupport.com/releases</url>
72-
<snapshots>
73-
<enabled>false</enabled>
74-
</snapshots>
75-
</repository>
76-
</repositories>
77-
7875
<build>
76+
<resources>
77+
<resource>
78+
<directory>src/main/java</directory>
79+
<includes>
80+
<include>**/*.properties</include>
81+
</includes>
82+
</resource>
83+
<resource>
84+
<directory>src/main/resources</directory>
85+
<includes>
86+
<include>**/*.css</include>
87+
<include>**/*.ttf</include>
88+
</includes>
89+
</resource>
90+
</resources>
7991
<plugins>
8092
<plugin>
8193
<groupId>org.apache.maven.plugins</groupId>
@@ -107,12 +119,16 @@
107119
<plugin>
108120
<groupId>org.apache.maven.plugins</groupId>
109121
<artifactId>maven-source-plugin</artifactId>
110-
<version>3.0.0</version>
111-
<configuration>
112-
<excludes>
113-
<exclude>**</exclude>
114-
</excludes>
115-
</configuration>
122+
<version>3.0.1</version>
123+
<executions>
124+
<execution>
125+
<id>attach-sources</id>
126+
<phase>verify</phase>
127+
<goals>
128+
<goal>jar-no-fork</goal>
129+
</goals>
130+
</execution>
131+
</executions>
116132
</plugin>
117133
<plugin>
118134
<groupId>org.revapi</groupId>
@@ -131,10 +147,6 @@
131147
<groupId>org.apache.maven.plugins</groupId>
132148
<artifactId>maven-javadoc-plugin</artifactId>
133149
<version>${javadoc.version}</version>
134-
<configuration>
135-
<quiet>true</quiet>
136-
<failOnError>true</failOnError>
137-
</configuration>
138150
<executions>
139151
<execution>
140152
<id>attach-javadocs</id>
@@ -143,6 +155,10 @@
143155
</goals>
144156
</execution>
145157
</executions>
158+
<configuration>
159+
<quiet>true</quiet>
160+
<failOnError>true</failOnError>
161+
</configuration>
146162
</plugin>
147163
<plugin>
148164
<groupId>org.apache.felix</groupId>
@@ -199,21 +215,5 @@
199215
</executions>
200216
</plugin>
201217
</plugins>
202-
<resources>
203-
<resource>
204-
<directory>src/main/java</directory>
205-
<includes>
206-
<include>**/*.properties</include>
207-
</includes>
208-
</resource>
209-
<resource>
210-
<directory>src/main/resources</directory>
211-
<includes>
212-
<include>**/*.css</include>
213-
<include>**/*.ttf</include>
214-
</includes>
215-
</resource>
216-
</resources>
217218
</build>
218-
219219
</project>

src/main/java/com/itextpdf/html2pdf/attach/impl/OutlineHandler.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ public void reset() {
178178
*/
179179
OutlineHandler addOutline(ITagWorker tagWorker, IElementNode element, ProcessorContext context) {
180180
String tagName = element.name();
181-
if (null != tagWorker && hasTagPriorityMapping(tagName)) {
181+
if (null != tagWorker && hasTagPriorityMapping(tagName) && context.getPdfDocument() != null) {
182182
int level = (int) getTagPriorityMapping(tagName);
183183
if (null == currentOutline) {
184184
currentOutline = context.getPdfDocument().getOutlines(false);
@@ -213,7 +213,7 @@ OutlineHandler addOutline(ITagWorker tagWorker, IElementNode element, ProcessorC
213213
*/
214214
OutlineHandler addDestination(ITagWorker tagWorker, IElementNode element) {
215215
String tagName = element.name();
216-
if (null != tagWorker && hasTagPriorityMapping(tagName)) {
216+
if (null != tagWorker && hasTagPriorityMapping(tagName) && destinationsInProcess.size()>0) {
217217
String content = destinationsInProcess.pop();
218218
if (tagWorker.getElementResult() instanceof IElement) {
219219
tagWorker.getElementResult().setProperty(Property.DESTINATION, content);

src/main/java/com/itextpdf/html2pdf/attach/wrapelement/TableWrapper.java

+12-6
Original file line numberDiff line numberDiff line change
@@ -197,16 +197,22 @@ public Table toTable(WaitingColgroupsHelper colgroupsHelper) {
197197
//Workaround to remove default width:100%
198198
table.deleteOwnProperty(Property.WIDTH);
199199
if (headerRows != null) {
200-
for (List<CellWrapper> headerRow : headerRows) {
201-
for (CellWrapper headerCell : headerRow) {
202-
table.addHeaderCell(headerCell.cell);
200+
for (int i = 0; i < headerRows.size(); i++) {
201+
for (int j = 0; j < headerRows.get(i).size(); j++) {
202+
table.addHeaderCell(headerRows.get(i).get(j).cell);
203+
}
204+
if (i != headerRows.size() - 1) {
205+
table.getHeader().startNewRow();
203206
}
204207
}
205208
}
206209
if (footerRows != null) {
207-
for (List<CellWrapper> footerRow : footerRows) {
208-
for (CellWrapper footerCell : footerRow) {
209-
table.addFooterCell(footerCell.cell);
210+
for (int i = 0; i < footerRows.size(); i++) {
211+
for (int j = 0; j < footerRows.get(i).size(); j++) {
212+
table.addFooterCell(footerRows.get(i).get(j).cell);
213+
}
214+
if (i != footerRows.size() - 1) {
215+
table.getFooter().startNewRow();
210216
}
211217
}
212218
}

src/main/java/com/itextpdf/html2pdf/css/CssConstants.java

+12
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ public class CssConstants {
102102
/** The Constant BORDER_BOTTOM_COLOR. */
103103
public static final String BORDER_BOTTOM_COLOR = "border-bottom-color";
104104

105+
/** The Constant BORDER_BOTTOM_LEFT_RADIUS. */
106+
public static final String BORDER_BOTTOM_LEFT_RADIUS= "border-bottom-left-radius";
107+
108+
/** The Constant BORDER_BOTTOM_RIGHT_RADIUS. */
109+
public static final String BORDER_BOTTOM_RIGHT_RADIUS= "border-bottom-right-radius";
110+
105111
/** The Constant BORDER_BOTTOM_STYLE. */
106112
public static final String BORDER_BOTTOM_STYLE = "border-bottom-style";
107113

@@ -156,6 +162,12 @@ public class CssConstants {
156162
/** The Constant BORDER_TOP_COLOR. */
157163
public static final String BORDER_TOP_COLOR = "border-top-color";
158164

165+
/** The Constant BORDER_TOP_LEFT_RADIUS. */
166+
public static final String BORDER_TOP_LEFT_RADIUS= "border-top-left-radius";
167+
168+
/** The Constant BORDER_TOP_RIGHT_RADIUS. */
169+
public static final String BORDER_TOP_RIGHT_RADIUS= "border-top-right-radius";
170+
159171
/** The Constant BORDER_TOP_STYLE. */
160172
public static final String BORDER_TOP_STYLE = "border-top-style";
161173

src/main/java/com/itextpdf/html2pdf/css/CssNestedAtRule.java

+5
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,9 @@ public String toString() {
142142
sb.append("\n}");
143143
return sb.toString();
144144
}
145+
146+
public String getRuleParameters() {
147+
return ruleParameters;
148+
}
149+
145150
}

src/main/java/com/itextpdf/html2pdf/css/CssRuleSet.java

+12-3
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ public class CssRuleSet extends CssStatement {
6969
private List<CssDeclaration> importantDeclarations;
7070

7171
/**
72-
* Creates a new {@link CssRuleSet}.
72+
* Creates a new {@link CssRuleSet} from selector and raw list of declarations.
73+
* The declarations are split into normal and important under the hood.
74+
* To construct the {@link CssRuleSet} instance from normal and important declarations, see
75+
* {@link #CssRuleSet(ICssSelector, List, List)}
7376
*
7477
* @param selector the CSS selector
7578
* @param declarations the CSS declarations
@@ -78,7 +81,13 @@ public CssRuleSet(ICssSelector selector, List<CssDeclaration> declarations) {
7881
this.selector = selector;
7982
this.normalDeclarations = new ArrayList<>();
8083
this.importantDeclarations = new ArrayList<>();
81-
splitDeclarationsIntoNormalAndImportant(declarations);
84+
splitDeclarationsIntoNormalAndImportant(declarations, normalDeclarations, importantDeclarations);
85+
}
86+
87+
public CssRuleSet(ICssSelector selector, List<CssDeclaration> normalDeclarations, List<CssDeclaration> importantDeclarations) {
88+
this.selector = selector;
89+
this.normalDeclarations = normalDeclarations;
90+
this.importantDeclarations = importantDeclarations;
8291
}
8392

8493
/* (non-Javadoc)
@@ -151,7 +160,7 @@ public List<CssDeclaration> getImportantDeclarations() {
151160
*
152161
* @param declarations the declarations
153162
*/
154-
private void splitDeclarationsIntoNormalAndImportant(List<CssDeclaration> declarations) {
163+
private static void splitDeclarationsIntoNormalAndImportant(List<CssDeclaration> declarations, List<CssDeclaration> normalDeclarations, List<CssDeclaration> importantDeclarations) {
155164
for (CssDeclaration declaration : declarations) {
156165
int exclIndex = declaration.getExpression().indexOf('!');
157166
if (exclIndex > 0 && importantMatcher.matcher(declaration.getExpression()).matches()) {

0 commit comments

Comments
 (0)