Skip to content

Commit 1d28ef8

Browse files
committed
Merge branch 'release/1.0.3' into 7.0-master
2 parents 58dfb66 + e044f85 commit 1d28ef8

File tree

50 files changed

+1590
-53
lines changed

Some content is hidden

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

50 files changed

+1590
-53
lines changed

itext.tests/itext.html2pdf.tests/Properties/AssemblyInfo.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77
[assembly: AssemblyConfiguration("")]
88
[assembly: AssemblyCompany("iText Group NV")]
99
[assembly: AssemblyProduct("iText")]
10-
[assembly: AssemblyCopyright("Copyright (c) 1998-2017 iText Group NV")]
10+
[assembly: AssemblyCopyright("Copyright (c) 1998-2018 iText Group NV")]
1111
[assembly: AssemblyTrademark("")]
1212
[assembly: AssemblyCulture("")]
1313

1414
[assembly: ComVisible(false)]
1515

1616
[assembly: Guid("ae4e5743-0665-4705-9a33-07ea57cdd269")]
1717

18-
[assembly: AssemblyVersion("1.0.2.0")]
19-
[assembly: AssemblyFileVersion("1.0.2.0")]
20-
[assembly: AssemblyInformationalVersion("1.0.2")]
18+
[assembly: AssemblyVersion("1.0.3.0")]
19+
[assembly: AssemblyFileVersion("1.0.3.0")]
20+
[assembly: AssemblyInformationalVersion("1.0.3")]
2121

2222
#if !NETSTANDARD1_6
2323
[assembly: NUnit.Framework.Timeout(300000)]

itext.tests/itext.html2pdf.tests/itext.html2pdf.tests.netstandard.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
<ProjectReference Include="..\..\..\itextcore\itext\itext.pdfa\itext.pdfa.netstandard.csproj" />
5454
<ProjectReference Include="..\..\..\itextcore\itext\itext.hyph\itext.hyph.netstandard.csproj" />
5555
<ProjectReference Include="..\..\..\itextcore\itext\itext.pdftest\itext.pdftest.netstandard.csproj" />
56-
<ProjectReference Include="..\..\..\typography\itext\itext.typography\itext.typography.netstandard.csproj" />
5756
<ProjectReference Include="..\..\itext\itext.html2pdf\itext.html2pdf.netstandard.csproj" />
5857
</ItemGroup>
5958
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp1.0'">

itext.tests/itext.html2pdf.tests/itext/html2pdf/Html2ElementsTest.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ source product.
4242
*/
4343
using System;
4444
using System.Collections.Generic;
45+
using iText.Html2pdf.Attach.Impl;
4546
using iText.Layout.Element;
4647
using iText.Layout.Properties;
4748
using iText.Test;
@@ -147,5 +148,25 @@ public virtual void HtmlToElementsTest08() {
147148
String html = "<html><p>Hello world!</p><meta name=\"author\" content=\"Bruno\"><table><tr><td>123</td><td><456></td></tr><tr><td>Long cell</td></tr></table><p>Hello world!</p></html>";
148149
HtmlConverter.ConvertToElements(html);
149150
}
151+
152+
/// <exception cref="System.IO.IOException"/>
153+
[NUnit.Framework.Test]
154+
public virtual void HtmlToElementsTest09() {
155+
//Test OutlineHandler exception throwing
156+
/*
157+
Outlines require a PdfDocument, and OutlineHandler is based around its availability
158+
Any convert to elements workflow of course doesn't have a PdfDocument.
159+
Instead of throwing an NPE when trying it, the OutlineHandler will check for the existence of a pdfDocument
160+
If no PdfDocument is found, the handler will do nothing silently
161+
*/
162+
String html = "<html><p>Hello world!</p><meta name=\"author\" content=\"Bruno\"><table><tr><td>123</td><td><456></td></tr><tr><td>Long cell</td></tr></table><p>Hello world!</p></html>";
163+
ConverterProperties props = new ConverterProperties();
164+
OutlineHandler outlineHandler = new OutlineHandler();
165+
outlineHandler.PutTagPriorityMapping("h1", 1);
166+
outlineHandler.PutTagPriorityMapping("h3", 2);
167+
outlineHandler.PutTagPriorityMapping("p", 3);
168+
props.SetOutlineHandler(outlineHandler);
169+
HtmlConverter.ConvertToElements(html);
170+
}
150171
}
151172
}

itext.tests/itext.html2pdf.tests/itext/html2pdf/ResourceResolverTest.cs

Lines changed: 106 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,16 @@ source product.
4949
using iText.Kernel;
5050
using iText.Test;
5151
using iText.Test.Attributes;
52+
using NUnit.Framework;
5253

5354
namespace iText.Html2pdf {
5455
public class ResourceResolverTest : ExtendedITextTest {
55-
public static readonly String sourceFolder = TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext.CurrentContext.TestDirectory) + "/resources/itext/html2pdf/ResourceResolverTest/";
56+
public static readonly String sourceFolder =
57+
TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext.CurrentContext.TestDirectory) +
58+
"/resources/itext/html2pdf/ResourceResolverTest/";
5659

5760
public static readonly String destinationFolder = NUnit.Framework.TestContext.CurrentContext.TestDirectory
58-
+ "/test/itext/html2pdf/ResourceResolverTest/";
61+
+ "/test/itext/html2pdf/ResourceResolverTest/";
5962

6063
[NUnit.Framework.OneTimeSetUp]
6164
public static void BeforeClass() {
@@ -70,71 +73,149 @@ public virtual void ResourceResolverTest03() {
7073
String outPdf = destinationFolder + "resourceResolverTest03.pdf";
7174
String cmpPdf = sourceFolder + "cmp_resourceResolverTest03.pdf";
7275

73-
using (FileStream fileInputStream = new FileStream(sourceFolder + "resourceResolverTest03.html", FileMode.Open, FileAccess.Read),
74-
fileOutputStream = new FileStream(outPdf, FileMode.Create)) {
75-
HtmlConverter.ConvertToPdf(fileInputStream, fileOutputStream, new ConverterProperties().SetBaseUri(baseUri));
76-
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, cmpPdf, destinationFolder, "diff03_"
76+
using (
77+
FileStream fileInputStream = new FileStream(sourceFolder + "resourceResolverTest03.html", FileMode.Open,
78+
FileAccess.Read),
79+
fileOutputStream = new FileStream(outPdf, FileMode.Create)) {
80+
HtmlConverter.ConvertToPdf(fileInputStream, fileOutputStream,
81+
new ConverterProperties().SetBaseUri(baseUri));
82+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, cmpPdf, destinationFolder,
83+
"diff03_"
7784
));
7885
}
7986
}
80-
87+
8188
/// <exception cref="System.IO.IOException"/>
8289
/// <exception cref="System.Exception"/>
8390
[NUnit.Framework.Test]
84-
public virtual void ResourceResolverTest07()
85-
{
91+
public virtual void ResourceResolverTest07() {
8692
String outPdf = destinationFolder + "resourceResolverTest07.pdf";
8793
String cmpPdf = sourceFolder + "cmp_resourceResolverTest07.pdf";
8894
HtmlConverter.ConvertToPdf(new FileInfo(sourceFolder + "resourceResolverTest07.html"), new FileInfo(outPdf
8995
));
90-
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, cmpPdf, destinationFolder, "diff07_"
96+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, cmpPdf, destinationFolder,
97+
"diff07_"
9198
));
9299
}
93100

94101
/// <exception cref="System.IO.IOException"/>
95102
/// <exception cref="System.Exception"/>
96103
[NUnit.Framework.Test]
97-
public virtual void ResourceResolverTest09()
98-
{
104+
public virtual void ResourceResolverTest09() {
99105
String outPdf = destinationFolder + "resourceResolverTest09.pdf";
100106
String cmpPdf = sourceFolder + "cmp_resourceResolverTest09.pdf";
101107
HtmlConverter.ConvertToPdf(new FileInfo(sourceFolder + "resourceResolverTest09.html"), new FileInfo(outPdf
102108
));
103-
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, cmpPdf, destinationFolder, "diff09_"
109+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, cmpPdf, destinationFolder,
110+
"diff09_"
104111
));
105112
}
106113

107114
/// <exception cref="System.IO.IOException"/>
108115
/// <exception cref="System.Exception"/>
109116
[NUnit.Framework.Test]
110-
public virtual void ResourceResolverTest10()
111-
{
117+
public virtual void ResourceResolverTest10() {
112118
String outPdf = destinationFolder + "resourceResolverTest10.pdf";
113119
String cmpPdf = sourceFolder + "cmp_resourceResolverTest10.pdf";
114-
using (FileStream fileInputStream = new FileStream(sourceFolder + "resourceResolverTest10.html", FileMode.Open, FileAccess.Read),
115-
fileOutputStream = new FileStream(outPdf, FileMode.Create)) {
116-
HtmlConverter.ConvertToPdf(fileInputStream, fileOutputStream, new ConverterProperties().SetBaseUri("%homepath%"));
120+
using (
121+
FileStream fileInputStream = new FileStream(sourceFolder + "resourceResolverTest10.html", FileMode.Open,
122+
FileAccess.Read),
123+
fileOutputStream = new FileStream(outPdf, FileMode.Create)) {
124+
HtmlConverter.ConvertToPdf(fileInputStream, fileOutputStream,
125+
new ConverterProperties().SetBaseUri("%homepath%"));
117126
NUnit.Framework.Assert.IsNull(
118127
new CompareTool().CompareByContent(outPdf, cmpPdf, destinationFolder, "diff10_"));
119-
}
128+
}
120129
}
121130

122131
/// <exception cref="System.IO.IOException"/>
123132
/// <exception cref="System.Exception"/>
124133
[NUnit.Framework.Test]
125-
public virtual void ResourceResolverTest11()
126-
{
134+
public virtual void ResourceResolverTest11() {
127135
String outPdf = destinationFolder + "resourceResolverTest11.pdf";
128136
String cmpPdf = sourceFolder + "cmp_resourceResolverTest11.pdf";
129-
using (FileStream fileInputStream = new FileStream(sourceFolder + "resourceResolverTest11.html", FileMode.Open, FileAccess.Read),
130-
fileOutputStream = new FileStream(outPdf, FileMode.Create))
131-
{
132-
HtmlConverter.ConvertToPdf(fileInputStream, fileOutputStream, new ConverterProperties().SetBaseUri("https://en.wikipedia.org/wiki/Welsh_Corgi"));
137+
using (
138+
FileStream fileInputStream = new FileStream(sourceFolder + "resourceResolverTest11.html", FileMode.Open,
139+
FileAccess.Read),
140+
fileOutputStream = new FileStream(outPdf, FileMode.Create)) {
141+
HtmlConverter.ConvertToPdf(fileInputStream, fileOutputStream,
142+
new ConverterProperties().SetBaseUri("https://en.wikipedia.org/wiki/Welsh_Corgi"));
133143
NUnit.Framework.Assert.IsNull(
134144
new CompareTool().CompareByContent(outPdf, cmpPdf, destinationFolder, "diff11_"));
135145
}
136146
}
137147

148+
[NUnit.Framework.Test]
149+
[Ignore("DEVSIX-1668")]
150+
public void ResourceResolverTest12() {
151+
String baseUri = sourceFolder + "path with spaces";
152+
153+
String outPdf = destinationFolder + "resourceResolverTest12.pdf";
154+
String cmpPdf = sourceFolder + "cmp_resourceResolverTest12.pdf";
155+
using (
156+
FileStream fileInputStream = new FileStream(sourceFolder + "resourceResolverTest12.html", FileMode.Open,
157+
FileAccess.Read),
158+
fileOutputStream = new FileStream(outPdf, FileMode.Create)) {
159+
HtmlConverter.ConvertToPdf(fileInputStream, fileOutputStream,
160+
new ConverterProperties().SetBaseUri(baseUri));
161+
NUnit.Framework.Assert.IsNull(
162+
new CompareTool().CompareByContent(outPdf, cmpPdf, destinationFolder, "diff12_"));
163+
}
164+
}
165+
166+
[NUnit.Framework.Test]
167+
public void ResourceResolverTest13() {
168+
String baseUri = sourceFolder;
169+
170+
String outPdf = destinationFolder + "resourceResolverTest13.pdf";
171+
String cmpPdf = sourceFolder + "cmp_resourceResolverTest13.pdf";
172+
using (
173+
FileStream fileInputStream = new FileStream(sourceFolder + "resourceResolverTest13.html", FileMode.Open,
174+
FileAccess.Read),
175+
fileOutputStream = new FileStream(outPdf, FileMode.Create)) {
176+
HtmlConverter.ConvertToPdf(fileInputStream, fileOutputStream,
177+
new ConverterProperties().SetBaseUri(baseUri));
178+
NUnit.Framework.Assert.IsNull(
179+
new CompareTool().CompareByContent(outPdf, cmpPdf, destinationFolder, "diff13_"));
180+
}
181+
}
182+
183+
[NUnit.Framework.Test]
184+
[Ignore("DEVSIX-1668")]
185+
public void ResourceResolverTest14() {
186+
String baseUri = sourceFolder + "path%20with%20spaces";
187+
188+
String outPdf = destinationFolder + "resourceResolverTest14.pdf";
189+
String cmpPdf = sourceFolder + "cmp_resourceResolverTest14.pdf";
190+
using (
191+
FileStream fileInputStream = new FileStream(sourceFolder + "resourceResolverTest12.html", FileMode.Open,
192+
FileAccess.Read),
193+
fileOutputStream = new FileStream(outPdf, FileMode.Create)) {
194+
HtmlConverter.ConvertToPdf(fileInputStream, fileOutputStream,
195+
new ConverterProperties().SetBaseUri(baseUri));
196+
NUnit.Framework.Assert.IsNull(
197+
new CompareTool().CompareByContent(outPdf, cmpPdf, destinationFolder, "diff14_"));
198+
}
199+
}
200+
201+
[NUnit.Framework.Test]
202+
203+
public void ResourceResolverTest15() {
204+
String baseUri = sourceFolder;
205+
206+
String outPdf = destinationFolder + "resourceResolverTest15.pdf";
207+
String cmpPdf = sourceFolder + "cmp_resourceResolverTest15.pdf";
208+
using (
209+
FileStream fileInputStream = new FileStream(sourceFolder + "resourceResolverTest15.html", FileMode.Open,
210+
FileAccess.Read),
211+
fileOutputStream = new FileStream(outPdf, FileMode.Create)) {
212+
HtmlConverter.ConvertToPdf(fileInputStream, fileOutputStream,
213+
new ConverterProperties().SetBaseUri(baseUri));
214+
NUnit.Framework.Assert.IsNull(
215+
new CompareTool().CompareByContent(outPdf, cmpPdf, destinationFolder, "diff15_"));
216+
}
217+
}
218+
138219

139220
// TODO test with absolute http links for resources?
140221
// TODO test with http base URI?

itext.tests/itext.html2pdf.tests/itext/html2pdf/css/BorderRadiusTest.cs

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,75 @@ public virtual void BorderRadius06Test() {
118118
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "borderRadiusTest06.pdf"
119119
, sourceFolder + "cmp_borderRadiusTest06.pdf", destinationFolder, "diff06_"));
120120
}
121+
122+
/// <exception cref="System.IO.IOException"/>
123+
/// <exception cref="System.Exception"/>
124+
[NUnit.Framework.Test]
125+
public virtual void BorderRadius07Test() {
126+
HtmlConverter.ConvertToPdf(new FileInfo(sourceFolder + "borderRadiusTest07.html"), new FileInfo(destinationFolder
127+
+ "borderRadiusTest07.pdf"));
128+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "borderRadiusTest07.pdf"
129+
, sourceFolder + "cmp_borderRadiusTest07.pdf", destinationFolder, "diff07_"));
130+
}
131+
132+
/// <exception cref="System.IO.IOException"/>
133+
/// <exception cref="System.Exception"/>
134+
[NUnit.Framework.Test]
135+
public virtual void BorderRadius08Test() {
136+
HtmlConverter.ConvertToPdf(new FileInfo(sourceFolder + "borderRadiusTest08.html"), new FileInfo(destinationFolder
137+
+ "borderRadiusTest08.pdf"));
138+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "borderRadiusTest08.pdf"
139+
, sourceFolder + "cmp_borderRadiusTest08.pdf", destinationFolder, "diff08_"));
140+
}
141+
142+
/// <exception cref="System.IO.IOException"/>
143+
/// <exception cref="System.Exception"/>
144+
[NUnit.Framework.Test]
145+
public virtual void BorderRadius09Test() {
146+
HtmlConverter.ConvertToPdf(new FileInfo(sourceFolder + "borderRadiusTest09.html"), new FileInfo(destinationFolder
147+
+ "borderRadiusTest09.pdf"));
148+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "borderRadiusTest09.pdf"
149+
, sourceFolder + "cmp_borderRadiusTest09.pdf", destinationFolder, "diff09_"));
150+
}
151+
152+
/// <exception cref="System.IO.IOException"/>
153+
/// <exception cref="System.Exception"/>
154+
[NUnit.Framework.Test]
155+
public virtual void BorderRadius10Test() {
156+
HtmlConverter.ConvertToPdf(new FileInfo(sourceFolder + "borderRadiusTest10.html"), new FileInfo(destinationFolder
157+
+ "borderRadiusTest10.pdf"));
158+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "borderRadiusTest10.pdf"
159+
, sourceFolder + "cmp_borderRadiusTest10.pdf", destinationFolder, "diff10_"));
160+
}
161+
162+
/// <exception cref="System.IO.IOException"/>
163+
/// <exception cref="System.Exception"/>
164+
[NUnit.Framework.Test]
165+
public virtual void BorderRadius11Test() {
166+
HtmlConverter.ConvertToPdf(new FileInfo(sourceFolder + "borderRadiusTest11.html"), new FileInfo(destinationFolder
167+
+ "borderRadiusTest11.pdf"));
168+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "borderRadiusTest11.pdf"
169+
, sourceFolder + "cmp_borderRadiusTest11.pdf", destinationFolder, "diff11_"));
170+
}
171+
172+
/// <exception cref="System.IO.IOException"/>
173+
/// <exception cref="System.Exception"/>
174+
[NUnit.Framework.Test]
175+
public virtual void BorderRadius12Test() {
176+
HtmlConverter.ConvertToPdf(new FileInfo(sourceFolder + "borderRadiusTest12.html"), new FileInfo(destinationFolder
177+
+ "borderRadiusTest12.pdf"));
178+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "borderRadiusTest12.pdf"
179+
, sourceFolder + "cmp_borderRadiusTest12.pdf", destinationFolder, "diff12_"));
180+
}
181+
182+
/// <exception cref="System.IO.IOException"/>
183+
/// <exception cref="System.Exception"/>
184+
[NUnit.Framework.Test]
185+
public virtual void BorderRadius13Test() {
186+
HtmlConverter.ConvertToPdf(new FileInfo(sourceFolder + "borderRadiusTest13.html"), new FileInfo(destinationFolder
187+
+ "borderRadiusTest13.pdf"));
188+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "borderRadiusTest13.pdf"
189+
, sourceFolder + "cmp_borderRadiusTest13.pdf", destinationFolder, "diff13_"));
190+
}
121191
}
122192
}

itext.tests/itext.html2pdf.tests/itext/html2pdf/element/TableTest.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,13 @@ public virtual void TableMaxHeightTest02() {
410410
RunTest("tableMaxHeight02");
411411
}
412412

413+
/// <exception cref="System.IO.IOException"/>
414+
/// <exception cref="System.Exception"/>
415+
[NUnit.Framework.Test]
416+
public virtual void MultipleRowsInHeader01() {
417+
RunTest("multipleRowsInHeader01");
418+
}
419+
413420
/// <exception cref="System.IO.IOException"/>
414421
/// <exception cref="System.Exception"/>
415422
[NUnit.Framework.Test]
12.3 KB
Loading
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<title>Page Title</title>
6+
</head>
7+
8+
<body>
9+
<div>
10+
<img src="itis.jpg">
11+
</div>
12+
<div><b>The content of the document......</b></div>
13+
14+
</body>
15+
16+
</html>

0 commit comments

Comments
 (0)