Skip to content

Commit c90df04

Browse files
committed
[RELEASE] Merge branch 'release/7.0.5' into 'master'
2 parents 1364688 + 7054a63 commit c90df04

File tree

391 files changed

+10686
-2660
lines changed

Some content is hidden

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

391 files changed

+10686
-2660
lines changed

iTextCore.netstandard.sln

Lines changed: 258 additions & 0 deletions
Large diffs are not rendered by default.

itext.tests/itext.barcodes.tests/Properties/AssemblyInfo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414

1515
[assembly: Guid("d015a3aa-613c-45d9-b908-7d47c4b613af")]
1616

17-
[assembly: AssemblyVersion("7.0.4.0")]
18-
[assembly: AssemblyFileVersion("7.0.4.0")]
19-
[assembly: AssemblyInformationalVersion("7.0.4")]
17+
[assembly: AssemblyVersion("7.0.5.0")]
18+
[assembly: AssemblyFileVersion("7.0.5.0")]
19+
[assembly: AssemblyInformationalVersion("7.0.5")]
2020

2121
#if !NETSTANDARD1_6
2222
[assembly: NUnit.Framework.Timeout(300000)]
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
2+
<PropertyGroup Label="Configuration">
3+
<SignAssembly>True</SignAssembly>
4+
<DelaySign>False</DelaySign>
5+
<WarningLevel>4</WarningLevel>
6+
</PropertyGroup>
7+
<PropertyGroup>
8+
<TargetFrameworks>netcoreapp1.0;net40</TargetFrameworks>
9+
</PropertyGroup>
10+
<PropertyGroup Condition=" '$(TargetFramework)' == 'net40' ">
11+
<OutputType>library</OutputType>
12+
</PropertyGroup>
13+
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">
14+
<OutputType>Library</OutputType>
15+
<DefineConstants>NETSTANDARD1_6</DefineConstants>
16+
</PropertyGroup>
17+
<PropertyGroup>
18+
<AssemblyOriginatorKeyFile>itext.snk</AssemblyOriginatorKeyFile>
19+
</PropertyGroup>
20+
<PropertyGroup>
21+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
22+
<ApplicationIcon />
23+
<OutputTypeEx>library</OutputTypeEx>
24+
<StartupObject />
25+
<AssemblyName>itext.barcodes.tests</AssemblyName>
26+
<RootNamespace />
27+
</PropertyGroup>
28+
<ItemGroup Condition=" '$(TargetFramework)' == 'net40' ">
29+
<Reference Include="System" />
30+
<Reference Include="System.Core" />
31+
</ItemGroup>
32+
<ItemGroup>
33+
<PackageReference Include="TeamCity.VSTest.TestAdapter" Version="1.0.0" />
34+
<PackageReference Include="NUnit" Version="3.7.1" />
35+
<PackageReference Include="NUnit3TestAdapter" Version="3.8.0" />
36+
</ItemGroup>
37+
<ItemGroup>
38+
<ProjectReference Include="..\..\itext\itext.barcodes\itext.barcodes.netstandard.csproj" />
39+
<ProjectReference Include="..\..\itext\itext.io\itext.io.netstandard.csproj" />
40+
<ProjectReference Include="..\..\itext\itext.kernel\itext.kernel.netstandard.csproj" />
41+
<ProjectReference Include="..\..\itext\itext.pdftest\itext.pdftest.netstandard.csproj" />
42+
</ItemGroup>
43+
<ItemGroup>
44+
</ItemGroup>
45+
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp1.0'">
46+
<PackageReference Include="Microsoft.NET.Test.Sdk">
47+
<Version>15.0.0</Version>
48+
</PackageReference>
49+
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation">
50+
<Version>4.3.0</Version>
51+
</PackageReference>
52+
</ItemGroup>
53+
</Project>

itext.tests/itext.barcodes.tests/itext/barcodes/Barcode128Test.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public virtual void Barcode01Test() {
7474
barcode.SetCodeType(Barcode128.CODE128);
7575
barcode.SetCode("9781935182610");
7676
barcode.SetTextAlignment(Barcode1D.ALIGN_LEFT);
77-
barcode.PlaceBarcode(canvas, Color.BLACK, Color.BLACK);
77+
barcode.PlaceBarcode(canvas, ColorConstants.BLACK, ColorConstants.BLACK);
7878
document.Close();
7979
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + filename, sourceFolder
8080
+ "cmp_" + filename, destinationFolder, "diff_"));
@@ -94,7 +94,7 @@ public virtual void Barcode02Test() {
9494
barcode.SetCodeType(Barcode128.CODE128);
9595
barcode.SetCode("9781935182610");
9696
barcode.SetTextAlignment(Barcode1D.ALIGN_LEFT);
97-
barcode.PlaceBarcode(canvas, Color.BLACK, Color.BLACK);
97+
barcode.PlaceBarcode(canvas, ColorConstants.BLACK, ColorConstants.BLACK);
9898
document.Close();
9999
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + filename, sourceFolder
100100
+ "cmp_" + filename, destinationFolder, "diff_"));

itext.tests/itext.barcodes.tests/itext/barcodes/Barcode39Test.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public virtual void Barcode01Test() {
7373
Barcode1D barcode = new Barcode39(document);
7474
barcode.SetCode("9781935182610");
7575
barcode.SetTextAlignment(Barcode1D.ALIGN_LEFT);
76-
barcode.PlaceBarcode(canvas, Color.BLACK, Color.BLACK);
76+
barcode.PlaceBarcode(canvas, ColorConstants.BLACK, ColorConstants.BLACK);
7777
document.Close();
7878
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + filename, sourceFolder
7979
+ "cmp_" + filename, destinationFolder, "diff_"));
@@ -91,7 +91,7 @@ public virtual void Barcode02Test() {
9191
Barcode1D barcode = new Barcode39(document);
9292
barcode.SetCode("9781935182610");
9393
barcode.SetTextAlignment(Barcode1D.ALIGN_LEFT);
94-
barcode.PlaceBarcode(canvas, Color.BLACK, Color.BLACK);
94+
barcode.PlaceBarcode(canvas, ColorConstants.BLACK, ColorConstants.BLACK);
9595
document.Close();
9696
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + filename, sourceFolder
9797
+ "cmp_" + filename, destinationFolder, "diff_"));

itext.tests/itext.barcodes.tests/itext/barcodes/BarcodeDataMatrixTest.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public virtual void Barcode01Test() {
7373
BarcodeDataMatrix barcode = new BarcodeDataMatrix();
7474
barcode.SetCode("AAAAAAAAAA;BBBBAAAA3;00028;BBBAA05;AAAA;AAAAAA;1234567;AQWXSZ;JEAN;;;;7894561;AQWXSZ;GEO;;;;1;1;1;1;0;0;1;0;1;0;0;0;1;0;1;0;0;0;0;0;0;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1"
7575
);
76-
barcode.PlaceBarcode(canvas, Color.GREEN, 5);
76+
barcode.PlaceBarcode(canvas, ColorConstants.GREEN, 5);
7777
document.Close();
7878
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + filename, sourceFolder
7979
+ "cmp_" + filename, destinationFolder, "diff_"));
@@ -90,7 +90,7 @@ public virtual void Barcode02Test() {
9090
PdfPage page1 = document.AddNewPage();
9191
PdfCanvas canvas = new PdfCanvas(page1);
9292
BarcodeDataMatrix barcode2 = new BarcodeDataMatrix("дима", "UTF-8");
93-
barcode2.PlaceBarcode(canvas, Color.GREEN, 10);
93+
barcode2.PlaceBarcode(canvas, ColorConstants.GREEN, 10);
9494
document.Close();
9595
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + filename, sourceFolder
9696
+ "cmp_" + filename, destinationFolder, "diff_"));
@@ -110,7 +110,7 @@ public virtual void Barcode03Test() {
110110
barcode3.SetWidth(36);
111111
barcode3.SetHeight(12);
112112
barcode3.SetCode("AbcdFFghijklmnopqrstuWXSQ");
113-
barcode3.PlaceBarcode(canvas, Color.BLACK, 10);
113+
barcode3.PlaceBarcode(canvas, ColorConstants.BLACK, 10);
114114
document.Close();
115115
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + filename, sourceFolder
116116
+ "cmp_" + filename, destinationFolder, "diff_"));
@@ -130,7 +130,7 @@ public virtual void Barcode04Test() {
130130
barcode3.SetWidth(36);
131131
barcode3.SetHeight(12);
132132
barcode3.SetCode("01AbcdefgAbcdefg123451231231234");
133-
barcode3.PlaceBarcode(canvas, Color.BLACK, 10);
133+
barcode3.PlaceBarcode(canvas, ColorConstants.BLACK, 10);
134134
document.Close();
135135
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + filename, sourceFolder
136136
+ "cmp_" + filename, destinationFolder, "diff_"));
@@ -150,7 +150,7 @@ public virtual void Barcode05Test() {
150150
barcode3.SetWidth(40);
151151
barcode3.SetHeight(40);
152152
barcode3.SetCode("aaabbbcccdddAAABBBAAABBaaabbbcccdddaaa");
153-
barcode3.PlaceBarcode(canvas, Color.BLACK, 10);
153+
barcode3.PlaceBarcode(canvas, ColorConstants.BLACK, 10);
154154
document.Close();
155155
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + filename, sourceFolder
156156
+ "cmp_" + filename, destinationFolder, "diff_"));
@@ -170,7 +170,7 @@ public virtual void Barcode06Test() {
170170
barcode3.SetWidth(36);
171171
barcode3.SetHeight(12);
172172
barcode3.SetCode(">>>\r>>>THIS VERY TEXT>>\r>");
173-
barcode3.PlaceBarcode(canvas, Color.BLACK, 10);
173+
barcode3.PlaceBarcode(canvas, ColorConstants.BLACK, 10);
174174
document.Close();
175175
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + filename, sourceFolder
176176
+ "cmp_" + filename, destinationFolder, "diff_"));

itext.tests/itext.barcodes.tests/itext/barcodes/BarcodeEANTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public virtual void Barcode01Test() {
7474
barcode.SetCodeType(BarcodeEAN.EAN13);
7575
barcode.SetCode("9781935182610");
7676
barcode.SetTextAlignment(Barcode1D.ALIGN_LEFT);
77-
barcode.PlaceBarcode(canvas, Color.BLACK, Color.BLACK);
77+
barcode.PlaceBarcode(canvas, ColorConstants.BLACK, ColorConstants.BLACK);
7878
document.Close();
7979
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + filename, sourceFolder
8080
+ "cmp_" + filename, destinationFolder, "diff_"));
@@ -94,7 +94,7 @@ public virtual void Barcode02Test() {
9494
barcode.SetCodeType(BarcodeEAN.EAN8);
9595
barcode.SetCode("97819351");
9696
barcode.SetTextAlignment(Barcode1D.ALIGN_LEFT);
97-
barcode.PlaceBarcode(canvas, Color.BLACK, Color.BLACK);
97+
barcode.PlaceBarcode(canvas, ColorConstants.BLACK, ColorConstants.BLACK);
9898
document.Close();
9999
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + filename, sourceFolder
100100
+ "cmp_" + filename, destinationFolder, "diff_"));
@@ -118,7 +118,7 @@ public virtual void Barcode03Test() {
118118
codeSUPP.SetCode("55999");
119119
codeSUPP.SetBaseline(-2);
120120
BarcodeEANSUPP eanSupp = new BarcodeEANSUPP(codeEAN, codeSUPP);
121-
eanSupp.PlaceBarcode(canvas, null, Color.BLUE);
121+
eanSupp.PlaceBarcode(canvas, null, ColorConstants.BLUE);
122122
document.Close();
123123
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + filename, sourceFolder
124124
+ "cmp_" + filename, destinationFolder, "diff_"));

itext.tests/itext.barcodes.tests/itext/barcodes/BarcodeInter25Test.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public virtual void Barcode01Test() {
7474
barcode.SetGenerateChecksum(true);
7575
barcode.SetCode("41-1200076041-001");
7676
barcode.SetTextAlignment(Barcode1D.ALIGN_CENTER);
77-
barcode.PlaceBarcode(canvas, Color.BLUE, Color.GREEN);
77+
barcode.PlaceBarcode(canvas, ColorConstants.BLUE, ColorConstants.GREEN);
7878
document.Close();
7979
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + filename, sourceFolder
8080
+ "cmp_" + filename, destinationFolder, "diff_"));
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
/*
2+
This file is part of the iText (R) project.
3+
Copyright (c) 1998-2017 iText Group NV
4+
Authors: iText Software.
5+
6+
This program is free software; you can redistribute it and/or modify
7+
it under the terms of the GNU Affero General Public License version 3
8+
as published by the Free Software Foundation with the addition of the
9+
following permission added to Section 15 as permitted in Section 7(a):
10+
FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY
11+
ITEXT GROUP. ITEXT GROUP DISCLAIMS THE WARRANTY OF NON INFRINGEMENT
12+
OF THIRD PARTY RIGHTS
13+
14+
This program is distributed in the hope that it will be useful, but
15+
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16+
or FITNESS FOR A PARTICULAR PURPOSE.
17+
See the GNU Affero General Public License for more details.
18+
You should have received a copy of the GNU Affero General Public License
19+
along with this program; if not, see http://www.gnu.org/licenses or write to
20+
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21+
Boston, MA, 02110-1301 USA, or download the license from the following URL:
22+
http://itextpdf.com/terms-of-use/
23+
24+
The interactive user interfaces in modified source and object code versions
25+
of this program must display Appropriate Legal Notices, as required under
26+
Section 5 of the GNU Affero General Public License.
27+
28+
In accordance with Section 7(b) of the GNU Affero General Public License,
29+
a covered work must retain the producer line in every PDF that is created
30+
or manipulated using iText.
31+
32+
You can be released from the requirements of the license by purchasing
33+
a commercial license. Buying such a license is mandatory as soon as you
34+
develop commercial activities involving the iText software without
35+
disclosing the source code of your own applications.
36+
These activities include: offering paid services to customers as an ASP,
37+
serving PDFs on the fly in a web application, shipping iText with a closed
38+
source product.
39+
40+
For more information, please contact iText Software Corp. at this
41+
42+
*/
43+
using System;
44+
using iText.Kernel.Colors;
45+
using iText.Kernel.Pdf;
46+
using iText.Kernel.Pdf.Canvas;
47+
using iText.Kernel.Utils;
48+
using iText.Test;
49+
50+
namespace iText.Barcodes {
51+
public class BarcodeMSITest : ExtendedITextTest {
52+
public static readonly String sourceFolder = iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext
53+
.CurrentContext.TestDirectory) + "/resources/itext/barcodes/";
54+
55+
public static readonly String destinationFolder = NUnit.Framework.TestContext.CurrentContext.TestDirectory
56+
+ "/test/itext/barcodes/BarcodeMSI/";
57+
58+
[NUnit.Framework.OneTimeSetUp]
59+
public static void BeforeClass() {
60+
CreateDestinationFolder(destinationFolder);
61+
}
62+
63+
/// <exception cref="System.IO.IOException"/>
64+
/// <exception cref="iText.Kernel.PdfException"/>
65+
/// <exception cref="System.Exception"/>
66+
[NUnit.Framework.Test]
67+
public virtual void Barcode01Test() {
68+
String filename = "barcodeMSI_01.pdf";
69+
PdfWriter writer = new PdfWriter(destinationFolder + filename);
70+
PdfDocument document = new PdfDocument(writer);
71+
PdfPage page = document.AddNewPage();
72+
PdfCanvas canvas = new PdfCanvas(page);
73+
Barcode1D barcode = new BarcodeMSI(document);
74+
barcode.SetCode("123456789");
75+
barcode.SetGenerateChecksum(true);
76+
barcode.SetTextAlignment(Barcode1D.ALIGN_LEFT);
77+
barcode.PlaceBarcode(canvas, ColorConstants.BLACK, ColorConstants.WHITE);
78+
document.Close();
79+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + filename, sourceFolder
80+
+ "cmp_" + filename, destinationFolder, "diff01_"));
81+
}
82+
83+
/// <exception cref="System.IO.IOException"/>
84+
/// <exception cref="System.Exception"/>
85+
[NUnit.Framework.Test]
86+
public virtual void Barcode02Test() {
87+
String filename = "barcodeMSI_02.pdf";
88+
PdfWriter writer = new PdfWriter(destinationFolder + filename);
89+
PdfReader reader = new PdfReader(sourceFolder + "DocumentWithTrueTypeFont1.pdf");
90+
PdfDocument document = new PdfDocument(reader, writer);
91+
PdfCanvas canvas = new PdfCanvas(document.GetLastPage());
92+
Barcode1D barcode = new BarcodeMSI(document);
93+
barcode.SetCode("9781935182610");
94+
barcode.SetTextAlignment(Barcode1D.ALIGN_LEFT);
95+
barcode.PlaceBarcode(canvas, ColorConstants.BLACK, ColorConstants.WHITE);
96+
document.Close();
97+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + filename, sourceFolder
98+
+ "cmp_" + filename, destinationFolder, "diff02_"));
99+
}
100+
101+
[NUnit.Framework.Test]
102+
public virtual void Barcode03Test() {
103+
byte[] expected = new byte[] { 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1,
104+
0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1 };
105+
byte[] barcodeBytes = BarcodeMSI.GetBarsMSI("1234");
106+
bool isEqual = iText.IO.Util.JavaUtil.ArraysEquals(expected, barcodeBytes);
107+
NUnit.Framework.Assert.IsTrue(isEqual);
108+
}
109+
110+
[NUnit.Framework.Test]
111+
public virtual void Barcode04Test() {
112+
String code = "0987654321";
113+
int expectedChecksum = 7;
114+
int checksum = BarcodeMSI.GetChecksum(code);
115+
NUnit.Framework.Assert.AreEqual(checksum, expectedChecksum);
116+
}
117+
}
118+
}

itext.tests/itext.barcodes.tests/itext/barcodes/BarcodePDF417Test.cs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@ source product.
4141
4242
*/
4343
using System;
44+
using iText.Kernel.Colors;
4445
using iText.Kernel.Pdf;
4546
using iText.Kernel.Pdf.Canvas;
47+
using iText.Kernel.Pdf.Xobject;
4648
using iText.Kernel.Utils;
4749
using iText.Test;
4850

@@ -98,5 +100,34 @@ public virtual void Barcode02Test() {
98100
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + filename, sourceFolder
99101
+ "cmp_" + filename, destinationFolder, "diff_"));
100102
}
103+
104+
/// <exception cref="System.IO.IOException"/>
105+
/// <exception cref="System.Exception"/>
106+
[NUnit.Framework.Test]
107+
public virtual void MacroPDF417Test01() {
108+
String filename = "barcode417Macro_01.pdf";
109+
PdfWriter writer = new PdfWriter(destinationFolder + filename);
110+
PdfDocument pdfDocument = new PdfDocument(writer);
111+
PdfCanvas pdfCanvas = new PdfCanvas(pdfDocument.AddNewPage());
112+
pdfCanvas.AddXObject(CreateMacroBarcodePart(pdfDocument, "This is PDF417 segment 0", 1, 1, 0), 1, 0, 0, 1,
113+
36, 791);
114+
pdfCanvas.AddXObject(CreateMacroBarcodePart(pdfDocument, "This is PDF417 segment 1", 1, 1, 1), 1, 0, 0, 1,
115+
36, 676);
116+
pdfDocument.Close();
117+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + filename, sourceFolder
118+
+ "cmp_" + filename, destinationFolder, "diff_"));
119+
}
120+
121+
private PdfFormXObject CreateMacroBarcodePart(PdfDocument document, String text, float mh, float mw, int segmentId
122+
) {
123+
BarcodePDF417 pf = new BarcodePDF417();
124+
// MacroPDF417 setup
125+
pf.SetOptions(BarcodePDF417.PDF417_USE_MACRO);
126+
pf.SetMacroFileId("12");
127+
pf.SetMacroSegmentCount(2);
128+
pf.SetMacroSegmentId(segmentId);
129+
pf.SetCode(text);
130+
return pf.CreateFormXObject(ColorConstants.BLACK, mw, mh, document);
131+
}
101132
}
102133
}

0 commit comments

Comments
 (0)