Skip to content

Commit

Permalink
[RELEASE] iText 7 pdfHTML 4.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
iText-CI committed Dec 20, 2021
2 parents 4a0ec0e + be5e57f commit 3624e5e
Show file tree
Hide file tree
Showing 790 changed files with 5,953 additions and 6,421 deletions.
4 changes: 2 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
def repoName = "pdfHtml"
def dependencyRegex = "itextcore"
def solutionFile = "itext.html2pdf.sln"
def csprojFramework = "netcoreapp2.0"
def frameworksToTest = "net461;netcoreapp2.0"

automaticDotnetBuild(repoName, dependencyRegex, solutionFile, csprojFramework)
automaticDotnetBuild(repoName, dependencyRegex, solutionFile, frameworksToTest)
1 change: 1 addition & 0 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,4 @@ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

2 changes: 1 addition & 1 deletion doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places.
# The default value is: My Project.

PROJECT_NAME = "pdfHTML 4.0.0 API"
PROJECT_NAME = "pdfHTML 4.0.1 API"

# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# could be handy for archiving the generated documentation or if some version
Expand Down
4 changes: 2 additions & 2 deletions itext.html2pdf.sln
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

Microsoft Visual Studio Solution File, Format Version 11.00
Project("{28A44613-21BB-46E2-BB98-23808869FDDE}") = "itext.html2pdf", "itext\itext.html2pdf\itext.html2pdf.netstandard.csproj", "{FF6BA09D-3655-466A-8C17-A7BFD3479CA1}"
Project("{28A44613-21BB-46E2-BB98-23808869FDDE}") = "itext.html2pdf", "itext\itext.html2pdf\itext.html2pdf.csproj", "{FF6BA09D-3655-466A-8C17-A7BFD3479CA1}"
EndProject
Project("{28A44613-21BB-46E2-BB98-23808869FDDE}") = "itext.html2pdf.tests", "itext.tests\itext.html2pdf.tests\itext.html2pdf.tests.netstandard.csproj", "{AE4E5743-0665-4705-9A33-07EA57CDD269}"
Project("{28A44613-21BB-46E2-BB98-23808869FDDE}") = "itext.html2pdf.tests", "itext.tests\itext.html2pdf.tests\itext.html2pdf.tests.csproj", "{AE4E5743-0665-4705-9A33-07EA57CDD269}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
6 changes: 3 additions & 3 deletions itext.tests/itext.html2pdf.tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

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

[assembly: AssemblyVersion("4.0.0.0")]
[assembly: AssemblyFileVersion("4.0.0.0")]
[assembly: AssemblyInformationalVersion("4.0.0")]
[assembly: AssemblyVersion("4.0.1.0")]
[assembly: AssemblyFileVersion("4.0.1.0")]
[assembly: AssemblyInformationalVersion("4.0.1")]

#if !NETSTANDARD2_0
[assembly: NUnit.Framework.Timeout(300000)]
Expand Down
243 changes: 56 additions & 187 deletions itext.tests/itext.html2pdf.tests/itext.html2pdf.tests.csproj

Large diffs are not rendered by default.

This file was deleted.

109 changes: 18 additions & 91 deletions itext.tests/itext.html2pdf.tests/itext/html2pdf/Html2PdfTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,165 +41,92 @@ source product.
address: sales@itextpdf.com
*/
using System;
using System.IO;
using iText.Html2pdf.Attach;
using iText.Html2pdf.Attach.Impl;
using iText.Html2pdf.Logs;
using iText.Html2pdf.Resolver.Font;
using iText.IO.Util;
using iText.Kernel.Pdf;
using iText.Kernel.Utils;
using iText.Layout;
using iText.Layout.Font;
using iText.StyledXmlParser;
using iText.StyledXmlParser.Css.Media;
using iText.StyledXmlParser.Node;
using iText.StyledXmlParser.Node.Impl.Jsoup;
using iText.Test;
using iText.Test.Attributes;

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

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

[NUnit.Framework.OneTimeSetUp]
public static void BeforeClass() {
CreateDestinationFolder(destinationFolder);
CreateOrClearDestinationFolder(DESTINATION_FOLDER);
}

[NUnit.Framework.Test]
public virtual void HelloWorldParagraphTest() {
ConvertAndCompare(sourceFolder + "hello_paragraph.html", destinationFolder + "hello_paragraph.pdf", sourceFolder
+ "cmp_hello_paragraph.pdf", destinationFolder, "diff01_");
ConvertToPdfAndCompare("hello_paragraph", SOURCE_FOLDER, DESTINATION_FOLDER);
}

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

[NUnit.Framework.Test]
public virtual void HelloMalformedDocumentTest() {
ConvertAndCompare(sourceFolder + "hello_malformed.html", destinationFolder + "hello_malformed.pdf", sourceFolder
+ "cmp_hello_malformed.pdf", destinationFolder, "diff03_");
ConvertToPdfAndCompare("hello_malformed", SOURCE_FOLDER, DESTINATION_FOLDER);
}

[NUnit.Framework.Test]
public virtual void HelloParagraphJunkSpacesDocumentTest() {
ConvertAndCompare(sourceFolder + "hello_paragraph_junk_spaces.html", destinationFolder + "hello_paragraph_junk_spaces.pdf"
, sourceFolder + "cmp_hello_paragraph_junk_spaces.pdf", destinationFolder, "diff03_");
ConvertToPdfAndCompare("hello_paragraph_junk_spaces", SOURCE_FOLDER, DESTINATION_FOLDER);
}

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

[NUnit.Framework.Test]
public virtual void HelloParagraphWithSpansDocumentTest() {
ConvertAndCompare(sourceFolder + "hello_paragraph_with_span.html", destinationFolder + "hello_paragraph_with_span.pdf"
, sourceFolder + "cmp_hello_paragraph_with_span.pdf", destinationFolder, "diff03_");
ConvertToPdfAndCompare("hello_paragraph_with_span", SOURCE_FOLDER, DESTINATION_FOLDER);
}

[NUnit.Framework.Test]
public virtual void HelloDivDocumentTest() {
ConvertAndCompare(sourceFolder + "hello_div.html", destinationFolder + "hello_div.pdf", sourceFolder + "cmp_hello_div.pdf"
, destinationFolder, "diff03_");
ConvertToPdfAndCompare("hello_div", SOURCE_FOLDER, DESTINATION_FOLDER);
}

[NUnit.Framework.Test]
public virtual void ABlockInPTagTest() {
ConvertAndCompare(sourceFolder + "aBlockInPTag.html", destinationFolder + "aBlockInPTag.pdf", sourceFolder
+ "cmp_aBlockInPTag.pdf", destinationFolder, "diff03_");
ConvertToPdfAndCompare("aBlockInPTag", SOURCE_FOLDER, DESTINATION_FOLDER);
}

[NUnit.Framework.Test]
public virtual void Base64svgTest() {
HtmlConverter.ConvertToPdf(new FileInfo(sourceFolder + "objectTag_base64svg.html"), new FileInfo(destinationFolder
+ "objectTag_base64svg.pdf"));
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "objectTag_base64svg.pdf"
, sourceFolder + "cmp_objectTag_base64svg.pdf", destinationFolder, "diff01_"));
ConvertToPdfAndCompare("objectTag_base64svg", SOURCE_FOLDER, DESTINATION_FOLDER);
}

[NUnit.Framework.Test]
[LogMessage(iText.StyledXmlParser.Logs.StyledXmlParserLogMessageConstant.UNABLE_TO_RETRIEVE_STREAM_WITH_GIVEN_BASE_URI
, Count = 1)]
[LogMessage(Html2PdfLogMessageConstant.WORKER_UNABLE_TO_PROCESS_OTHER_WORKER, Count = 1)]
public virtual void HtmlObjectIncorrectBase64Test() {
HtmlConverter.ConvertToPdf(new FileInfo(sourceFolder + "objectTag_incorrectBase64svg.html"), new FileInfo(
destinationFolder + "objectTag_incorrectBase64svg.pdf"));
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "objectTag_incorrectBase64svg.pdf"
, sourceFolder + "cmp_objectTag_incorrectBase64svg.pdf", destinationFolder, "diff01_"));
ConvertToPdfAndCompare("objectTag_incorrectBase64svg", SOURCE_FOLDER, DESTINATION_FOLDER);
}

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

[NUnit.Framework.Test]
[LogMessage(Html2PdfLogMessageConstant.WORKER_UNABLE_TO_PROCESS_OTHER_WORKER, Count = 1)]
public virtual void HtmlObjectNestedObjectTest() {
HtmlConverter.ConvertToPdf(new FileInfo(sourceFolder + "objectTag_nestedTag.html"), new FileInfo(destinationFolder
+ "objectTag_nestedTag.pdf"));
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "objectTag_nestedTag.pdf"
, sourceFolder + "cmp_objectTag_nestedTag.pdf", destinationFolder, "diff01_"));
}

[NUnit.Framework.Test]
[LogMessage(iText.StyledXmlParser.Logs.StyledXmlParserLogMessageConstant.RULE_IS_NOT_SUPPORTED, Ignore = true
)]
[LogMessage(Html2PdfLogMessageConstant.CSS_PROPERTY_IN_PERCENTS_NOT_SUPPORTED, Ignore = true)]
[LogMessage(Html2PdfLogMessageConstant.PADDING_VALUE_IN_PERCENT_NOT_SUPPORTED, Ignore = true)]
[LogMessage(Html2PdfLogMessageConstant.MARGIN_VALUE_IN_PERCENT_NOT_SUPPORTED, Ignore = true)]
[LogMessage(Html2PdfLogMessageConstant.ERROR_PARSING_CSS_SELECTOR, Ignore = true)]
[LogMessage(iText.IO.Logs.IoLogMessageConstant.WIDOWS_CONSTRAINT_VIOLATED, Ignore = true)]
public virtual void BatchConversionTest() {
ConverterProperties properties = new ConverterProperties().SetBaseUri(sourceFolder).SetMediaDeviceDescription
(new MediaDeviceDescription(MediaType.PRINT));
FontProvider fontProvider = new DefaultFontProvider(true, false, false);
fontProvider.AddDirectory(sourceFolder + "fonts/");
properties.SetFontProvider(fontProvider);
IHtmlProcessor processor = new DefaultHtmlProcessor(properties);
IXmlParser parser = new JsoupHtmlParser();
String outPdfPath = destinationFolder + "smashing1.pdf";
PdfDocument pdfDocument = new PdfDocument(new PdfWriter(outPdfPath));
IDocumentNode doc = parser.Parse(new FileStream(sourceFolder + "smashing01.html", FileMode.Open, FileAccess.Read
), properties.GetCharset());
Document document = processor.ProcessDocument(doc, pdfDocument);
document.Close();
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdfPath, sourceFolder + "cmp_smashing1.pdf"
, destinationFolder, "diff01_"));
ConvertToPdfAndCompare("objectTag_nestedTag", SOURCE_FOLDER, DESTINATION_FOLDER);
}

[NUnit.Framework.Test]
public virtual void HtmlImgBase64SVGTest() {
HtmlConverter.ConvertToPdf(new FileInfo(sourceFolder + "imgTag_base64svg.html"), new FileInfo(destinationFolder
+ "imgTag_base64svg.pdf"));
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "imgTag_base64svg.pdf"
, sourceFolder + "cmp_imgTag_base64svg.pdf", destinationFolder, "diff01_"));
}

private void ConvertAndCompare(String srcFilename, String outFilename, String cmpFilename, String outFolder
, String diff) {
HtmlConverter.ConvertToPdf(new FileInfo(srcFilename), new FileInfo(outFilename));
System.Console.Out.WriteLine("html: " + UrlUtil.GetNormalizedFileUriString(srcFilename) + "\n");
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFilename, cmpFilename, outFolder, diff
));
ConvertToPdfAndCompare("imgTag_base64svg", SOURCE_FOLDER, DESTINATION_FOLDER);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,19 @@ public virtual void DefaultOutlineHandlerWithHTagHavingIdTest() {
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFile, cmpFile, DESTINATION_FOLDER, "diff_defaultOutlineHandlerWithHTagHavingIdTest"
));
}

[NUnit.Framework.Test]
public virtual void ResetOutlineHandlerTest() {
OutlineHandler outlineHandler = OutlineHandler.CreateStandardHandler();
for (int i = 1; i <= 3; i++) {
String srcHtml = SOURCE_FOLDER + "outlines0" + i + ".html";
String outPdf = DESTINATION_FOLDER + "outlines0" + i + ".pdf";
String cmpPdf = SOURCE_FOLDER + "cmp_outlines0" + i + ".pdf";
HtmlConverter.ConvertToPdf(new FileInfo(srcHtml), new FileInfo(outPdf), new ConverterProperties().SetOutlineHandler
(outlineHandler));
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, cmpPdf, DESTINATION_FOLDER, "diff_"
+ i));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public virtual void DifferentDirsOfDlsTest() {
}

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

0 comments on commit 3624e5e

Please sign in to comment.