Skip to content

Commit 3624e5e

Browse files
committed
[RELEASE] iText 7 pdfHTML 4.0.1
2 parents 4a0ec0e + be5e57f commit 3624e5e

File tree

790 files changed

+5953
-6421
lines changed

Some content is hidden

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

790 files changed

+5953
-6421
lines changed

Jenkinsfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
def repoName = "pdfHtml"
55
def dependencyRegex = "itextcore"
66
def solutionFile = "itext.html2pdf.sln"
7-
def csprojFramework = "netcoreapp2.0"
7+
def frameworksToTest = "net461;netcoreapp2.0"
88

9-
automaticDotnetBuild(repoName, dependencyRegex, solutionFile, csprojFramework)
9+
automaticDotnetBuild(repoName, dependencyRegex, solutionFile, frameworksToTest)

NOTICE.txt

+1
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,4 @@ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
105105
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
106106
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
107107
OTHER DEALINGS IN THE FONT SOFTWARE.
108+

doxyfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8
3232
# title of most generated pages and in a few other places.
3333
# The default value is: My Project.
3434

35-
PROJECT_NAME = "pdfHTML 4.0.0 API"
35+
PROJECT_NAME = "pdfHTML 4.0.1 API"
3636

3737
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
3838
# could be handy for archiving the generated documentation or if some version

itext.html2pdf.sln

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11

22
Microsoft Visual Studio Solution File, Format Version 11.00
3-
Project("{28A44613-21BB-46E2-BB98-23808869FDDE}") = "itext.html2pdf", "itext\itext.html2pdf\itext.html2pdf.netstandard.csproj", "{FF6BA09D-3655-466A-8C17-A7BFD3479CA1}"
3+
Project("{28A44613-21BB-46E2-BB98-23808869FDDE}") = "itext.html2pdf", "itext\itext.html2pdf\itext.html2pdf.csproj", "{FF6BA09D-3655-466A-8C17-A7BFD3479CA1}"
44
EndProject
5-
Project("{28A44613-21BB-46E2-BB98-23808869FDDE}") = "itext.html2pdf.tests", "itext.tests\itext.html2pdf.tests\itext.html2pdf.tests.netstandard.csproj", "{AE4E5743-0665-4705-9A33-07EA57CDD269}"
5+
Project("{28A44613-21BB-46E2-BB98-23808869FDDE}") = "itext.html2pdf.tests", "itext.tests\itext.html2pdf.tests\itext.html2pdf.tests.csproj", "{AE4E5743-0665-4705-9A33-07EA57CDD269}"
66
EndProject
77
Global
88
GlobalSection(SolutionConfigurationPlatforms) = preSolution

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515

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

18-
[assembly: AssemblyVersion("4.0.0.0")]
19-
[assembly: AssemblyFileVersion("4.0.0.0")]
20-
[assembly: AssemblyInformationalVersion("4.0.0")]
18+
[assembly: AssemblyVersion("4.0.1.0")]
19+
[assembly: AssemblyFileVersion("4.0.1.0")]
20+
[assembly: AssemblyInformationalVersion("4.0.1")]
2121

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

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

+56-187
Large diffs are not rendered by default.

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

-68
This file was deleted.

itext.tests/itext.html2pdf.tests/itext/html2pdf/Html2PdfTest.cs

+18-91
Original file line numberDiff line numberDiff line change
@@ -41,165 +41,92 @@ source product.
4141
4242
*/
4343
using System;
44-
using System.IO;
45-
using iText.Html2pdf.Attach;
46-
using iText.Html2pdf.Attach.Impl;
4744
using iText.Html2pdf.Logs;
48-
using iText.Html2pdf.Resolver.Font;
49-
using iText.IO.Util;
50-
using iText.Kernel.Pdf;
51-
using iText.Kernel.Utils;
52-
using iText.Layout;
53-
using iText.Layout.Font;
54-
using iText.StyledXmlParser;
55-
using iText.StyledXmlParser.Css.Media;
56-
using iText.StyledXmlParser.Node;
57-
using iText.StyledXmlParser.Node.Impl.Jsoup;
58-
using iText.Test;
5945
using iText.Test.Attributes;
6046

6147
namespace iText.Html2pdf {
62-
public class Html2PdfTest : ExtendedITextTest {
63-
public static readonly String sourceFolder = iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext
48+
public class Html2PdfTest : ExtendedHtmlConversionITextTest {
49+
public static readonly String SOURCE_FOLDER = iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext
6450
.CurrentContext.TestDirectory) + "/resources/itext/html2pdf/Html2PdfTest/";
6551

66-
public static readonly String destinationFolder = NUnit.Framework.TestContext.CurrentContext.TestDirectory
52+
public static readonly String DESTINATION_FOLDER = NUnit.Framework.TestContext.CurrentContext.TestDirectory
6753
+ "/test/itext/html2pdf/Html2PdfTest/";
6854

6955
[NUnit.Framework.OneTimeSetUp]
7056
public static void BeforeClass() {
71-
CreateDestinationFolder(destinationFolder);
57+
CreateOrClearDestinationFolder(DESTINATION_FOLDER);
7258
}
7359

7460
[NUnit.Framework.Test]
7561
public virtual void HelloWorldParagraphTest() {
76-
ConvertAndCompare(sourceFolder + "hello_paragraph.html", destinationFolder + "hello_paragraph.pdf", sourceFolder
77-
+ "cmp_hello_paragraph.pdf", destinationFolder, "diff01_");
62+
ConvertToPdfAndCompare("hello_paragraph", SOURCE_FOLDER, DESTINATION_FOLDER);
7863
}
7964

8065
[NUnit.Framework.Test]
8166
public virtual void HelloParagraphTableTest() {
82-
// TODO DEVSIX-1124
83-
ConvertAndCompare(sourceFolder + "hello_paragraph_table.html", destinationFolder + "hello_paragraph_table.pdf"
84-
, sourceFolder + "cmp_hello_paragraph_table.pdf", destinationFolder, "diff02_");
67+
ConvertToPdfAndCompare("hello_paragraph_table", SOURCE_FOLDER, DESTINATION_FOLDER);
8568
}
8669

8770
[NUnit.Framework.Test]
8871
public virtual void HelloMalformedDocumentTest() {
89-
ConvertAndCompare(sourceFolder + "hello_malformed.html", destinationFolder + "hello_malformed.pdf", sourceFolder
90-
+ "cmp_hello_malformed.pdf", destinationFolder, "diff03_");
72+
ConvertToPdfAndCompare("hello_malformed", SOURCE_FOLDER, DESTINATION_FOLDER);
9173
}
9274

9375
[NUnit.Framework.Test]
9476
public virtual void HelloParagraphJunkSpacesDocumentTest() {
95-
ConvertAndCompare(sourceFolder + "hello_paragraph_junk_spaces.html", destinationFolder + "hello_paragraph_junk_spaces.pdf"
96-
, sourceFolder + "cmp_hello_paragraph_junk_spaces.pdf", destinationFolder, "diff03_");
77+
ConvertToPdfAndCompare("hello_paragraph_junk_spaces", SOURCE_FOLDER, DESTINATION_FOLDER);
9778
}
9879

9980
[NUnit.Framework.Test]
10081
public virtual void HelloParagraphNestedInTableDocumentTest() {
101-
// TODO DEVSIX-1124
102-
ConvertAndCompare(sourceFolder + "hello_paragraph_nested_in_table.html", destinationFolder + "hello_paragraph_nested_in_table.pdf"
103-
, sourceFolder + "cmp_hello_paragraph_nested_in_table.pdf", destinationFolder, "diff03_");
82+
ConvertToPdfAndCompare("hello_paragraph_nested_in_table", SOURCE_FOLDER, DESTINATION_FOLDER);
10483
}
10584

10685
[NUnit.Framework.Test]
10786
public virtual void HelloParagraphWithSpansDocumentTest() {
108-
ConvertAndCompare(sourceFolder + "hello_paragraph_with_span.html", destinationFolder + "hello_paragraph_with_span.pdf"
109-
, sourceFolder + "cmp_hello_paragraph_with_span.pdf", destinationFolder, "diff03_");
87+
ConvertToPdfAndCompare("hello_paragraph_with_span", SOURCE_FOLDER, DESTINATION_FOLDER);
11088
}
11189

11290
[NUnit.Framework.Test]
11391
public virtual void HelloDivDocumentTest() {
114-
ConvertAndCompare(sourceFolder + "hello_div.html", destinationFolder + "hello_div.pdf", sourceFolder + "cmp_hello_div.pdf"
115-
, destinationFolder, "diff03_");
92+
ConvertToPdfAndCompare("hello_div", SOURCE_FOLDER, DESTINATION_FOLDER);
11693
}
11794

11895
[NUnit.Framework.Test]
11996
public virtual void ABlockInPTagTest() {
120-
ConvertAndCompare(sourceFolder + "aBlockInPTag.html", destinationFolder + "aBlockInPTag.pdf", sourceFolder
121-
+ "cmp_aBlockInPTag.pdf", destinationFolder, "diff03_");
97+
ConvertToPdfAndCompare("aBlockInPTag", SOURCE_FOLDER, DESTINATION_FOLDER);
12298
}
12399

124100
[NUnit.Framework.Test]
125101
public virtual void Base64svgTest() {
126-
HtmlConverter.ConvertToPdf(new FileInfo(sourceFolder + "objectTag_base64svg.html"), new FileInfo(destinationFolder
127-
+ "objectTag_base64svg.pdf"));
128-
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "objectTag_base64svg.pdf"
129-
, sourceFolder + "cmp_objectTag_base64svg.pdf", destinationFolder, "diff01_"));
102+
ConvertToPdfAndCompare("objectTag_base64svg", SOURCE_FOLDER, DESTINATION_FOLDER);
130103
}
131104

132105
[NUnit.Framework.Test]
133106
[LogMessage(iText.StyledXmlParser.Logs.StyledXmlParserLogMessageConstant.UNABLE_TO_RETRIEVE_STREAM_WITH_GIVEN_BASE_URI
134107
, Count = 1)]
135108
[LogMessage(Html2PdfLogMessageConstant.WORKER_UNABLE_TO_PROCESS_OTHER_WORKER, Count = 1)]
136109
public virtual void HtmlObjectIncorrectBase64Test() {
137-
HtmlConverter.ConvertToPdf(new FileInfo(sourceFolder + "objectTag_incorrectBase64svg.html"), new FileInfo(
138-
destinationFolder + "objectTag_incorrectBase64svg.pdf"));
139-
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "objectTag_incorrectBase64svg.pdf"
140-
, sourceFolder + "cmp_objectTag_incorrectBase64svg.pdf", destinationFolder, "diff01_"));
110+
ConvertToPdfAndCompare("objectTag_incorrectBase64svg", SOURCE_FOLDER, DESTINATION_FOLDER);
141111
}
142112

143113
[NUnit.Framework.Test]
114+
//TODO: update after DEVSIX-1346
144115
[LogMessage(Html2PdfLogMessageConstant.WORKER_UNABLE_TO_PROCESS_IT_S_TEXT_CONTENT, Count = 1)]
145116
[LogMessage(Html2PdfLogMessageConstant.WORKER_UNABLE_TO_PROCESS_OTHER_WORKER, Count = 2)]
146117
public virtual void HtmlObjectAltTextTest() {
147-
//update after DEVSIX-1346
148-
HtmlConverter.ConvertToPdf(new FileInfo(sourceFolder + "objectTag_altText.html"), new FileInfo(destinationFolder
149-
+ "objectTag_altText.pdf"));
150-
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "objectTag_altText.pdf"
151-
, sourceFolder + "cmp_objectTag_altText.pdf", destinationFolder, "diff01_"));
118+
ConvertToPdfAndCompare("objectTag_altText", SOURCE_FOLDER, DESTINATION_FOLDER);
152119
}
153120

154121
[NUnit.Framework.Test]
155122
[LogMessage(Html2PdfLogMessageConstant.WORKER_UNABLE_TO_PROCESS_OTHER_WORKER, Count = 1)]
156123
public virtual void HtmlObjectNestedObjectTest() {
157-
HtmlConverter.ConvertToPdf(new FileInfo(sourceFolder + "objectTag_nestedTag.html"), new FileInfo(destinationFolder
158-
+ "objectTag_nestedTag.pdf"));
159-
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "objectTag_nestedTag.pdf"
160-
, sourceFolder + "cmp_objectTag_nestedTag.pdf", destinationFolder, "diff01_"));
161-
}
162-
163-
[NUnit.Framework.Test]
164-
[LogMessage(iText.StyledXmlParser.Logs.StyledXmlParserLogMessageConstant.RULE_IS_NOT_SUPPORTED, Ignore = true
165-
)]
166-
[LogMessage(Html2PdfLogMessageConstant.CSS_PROPERTY_IN_PERCENTS_NOT_SUPPORTED, Ignore = true)]
167-
[LogMessage(Html2PdfLogMessageConstant.PADDING_VALUE_IN_PERCENT_NOT_SUPPORTED, Ignore = true)]
168-
[LogMessage(Html2PdfLogMessageConstant.MARGIN_VALUE_IN_PERCENT_NOT_SUPPORTED, Ignore = true)]
169-
[LogMessage(Html2PdfLogMessageConstant.ERROR_PARSING_CSS_SELECTOR, Ignore = true)]
170-
[LogMessage(iText.IO.Logs.IoLogMessageConstant.WIDOWS_CONSTRAINT_VIOLATED, Ignore = true)]
171-
public virtual void BatchConversionTest() {
172-
ConverterProperties properties = new ConverterProperties().SetBaseUri(sourceFolder).SetMediaDeviceDescription
173-
(new MediaDeviceDescription(MediaType.PRINT));
174-
FontProvider fontProvider = new DefaultFontProvider(true, false, false);
175-
fontProvider.AddDirectory(sourceFolder + "fonts/");
176-
properties.SetFontProvider(fontProvider);
177-
IHtmlProcessor processor = new DefaultHtmlProcessor(properties);
178-
IXmlParser parser = new JsoupHtmlParser();
179-
String outPdfPath = destinationFolder + "smashing1.pdf";
180-
PdfDocument pdfDocument = new PdfDocument(new PdfWriter(outPdfPath));
181-
IDocumentNode doc = parser.Parse(new FileStream(sourceFolder + "smashing01.html", FileMode.Open, FileAccess.Read
182-
), properties.GetCharset());
183-
Document document = processor.ProcessDocument(doc, pdfDocument);
184-
document.Close();
185-
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdfPath, sourceFolder + "cmp_smashing1.pdf"
186-
, destinationFolder, "diff01_"));
124+
ConvertToPdfAndCompare("objectTag_nestedTag", SOURCE_FOLDER, DESTINATION_FOLDER);
187125
}
188126

189127
[NUnit.Framework.Test]
190128
public virtual void HtmlImgBase64SVGTest() {
191-
HtmlConverter.ConvertToPdf(new FileInfo(sourceFolder + "imgTag_base64svg.html"), new FileInfo(destinationFolder
192-
+ "imgTag_base64svg.pdf"));
193-
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "imgTag_base64svg.pdf"
194-
, sourceFolder + "cmp_imgTag_base64svg.pdf", destinationFolder, "diff01_"));
195-
}
196-
197-
private void ConvertAndCompare(String srcFilename, String outFilename, String cmpFilename, String outFolder
198-
, String diff) {
199-
HtmlConverter.ConvertToPdf(new FileInfo(srcFilename), new FileInfo(outFilename));
200-
System.Console.Out.WriteLine("html: " + UrlUtil.GetNormalizedFileUriString(srcFilename) + "\n");
201-
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFilename, cmpFilename, outFolder, diff
202-
));
129+
ConvertToPdfAndCompare("imgTag_base64svg", SOURCE_FOLDER, DESTINATION_FOLDER);
203130
}
204131
}
205132
}

itext.tests/itext.html2pdf.tests/itext/html2pdf/attach/impl/OutlineHandlerTest.cs

+14
Original file line numberDiff line numberDiff line change
@@ -104,5 +104,19 @@ public virtual void DefaultOutlineHandlerWithHTagHavingIdTest() {
104104
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFile, cmpFile, DESTINATION_FOLDER, "diff_defaultOutlineHandlerWithHTagHavingIdTest"
105105
));
106106
}
107+
108+
[NUnit.Framework.Test]
109+
public virtual void ResetOutlineHandlerTest() {
110+
OutlineHandler outlineHandler = OutlineHandler.CreateStandardHandler();
111+
for (int i = 1; i <= 3; i++) {
112+
String srcHtml = SOURCE_FOLDER + "outlines0" + i + ".html";
113+
String outPdf = DESTINATION_FOLDER + "outlines0" + i + ".pdf";
114+
String cmpPdf = SOURCE_FOLDER + "cmp_outlines0" + i + ".pdf";
115+
HtmlConverter.ConvertToPdf(new FileInfo(srcHtml), new FileInfo(outPdf), new ConverterProperties().SetOutlineHandler
116+
(outlineHandler));
117+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, cmpPdf, DESTINATION_FOLDER, "diff_"
118+
+ i));
119+
}
120+
}
107121
}
108122
}

itext.tests/itext.html2pdf.tests/itext/html2pdf/attribute/DirAttributeTest.cs

-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ public virtual void DifferentDirsOfDlsTest() {
6565
}
6666

6767
[NUnit.Framework.Test]
68-
// TODO DEVSIX-5070 Process dots of ordered list items in the specified direction
6968
[LogMessage(iText.IO.Logs.IoLogMessageConstant.TYPOGRAPHY_NOT_FOUND, Count = 18)]
7069
public virtual void DifferentDirsOfOrderedListsTest() {
7170
ConvertToPdfAndCompare("differentDirsOfOrderedLists", sourceFolder, destinationFolder);

0 commit comments

Comments
 (0)