Skip to content

Commit 2304b47

Browse files
committed
Merge branch 'release/5.5.13'
2 parents af371da + 18237aa commit 2304b47

36 files changed

+634
-284
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,9 @@ $RECYCLE.BIN/
222222
target/
223223
nbactions*.xml
224224
src/core/iTextSharp.xml
225+
226+
# JetBrains Rider
227+
.idea/
228+
229+
#Linux files
230+
.directory

src/BuildAll(VS2010).sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "itext-hyph-xml(VS2010)", "e
99
EndProject
1010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "itextsharp.xmlworker(VS2010)", "extras\itextsharp.xmlworker\itextsharp.xmlworker(VS2010).csproj", "{96647204-4A3E-41D7-BC74-B1608D6D1857}"
1111
EndProject
12-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "itextsharp.xtra(VS2010)", "extras\itextsharp.xtra\itextsharp.xtra(VS2010).csproj", "{BE1934CF-90A9-43D3-A794-7E540874EDBB}"
12+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "iTextSharp.xtra(VS2010)", "extras\iTextSharp.xtra\iTextSharp.xtra(VS2010).csproj", "{BE1934CF-90A9-43D3-A794-7E540874EDBB}"
1313
EndProject
1414
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "iTextAsian(VS2010)", "extras\iTextAsian\iTextAsian(VS2010).csproj", "{2F467830-A94B-4C44-B17B-0A81CBDB8CB2}"
1515
EndProject

src/BuildAll.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "itext-hyph-xml", "extras\it
77
EndProject
88
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "itextsharp.xmlworker", "extras\itextsharp.xmlworker\itextsharp.xmlworker.csproj", "{96647204-4A3E-41D7-BC74-B1608D6D1857}"
99
EndProject
10-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "itextsharp.xtra", "extras\itextsharp.xtra\itextsharp.xtra.csproj", "{BE1934CF-90A9-43D3-A794-7E540874EDBB}"
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "itextsharp.xtra", "extras\iTextSharp.xtra\iTextSharp.xtra.csproj", "{BE1934CF-90A9-43D3-A794-7E540874EDBB}"
1111
EndProject
1212
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "iTextAsian", "extras\iTextAsian\iTextAsian.csproj", "{2F467830-A94B-4C44-B17B-0A81CBDB8CB2}"
1313
EndProject

src/core/AssemblyInfo.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
using System.Reflection;
22
using System.Runtime.CompilerServices;
33
using System.Runtime.InteropServices;
4+
using Versions.Attributes;
45

56
[assembly: AssemblyTitle("iTextSharp")]
67
[assembly: AssemblyDescription("A free PDF library ported from Java iText.")]
78
[assembly: AssemblyConfiguration("")]
89
[assembly: AssemblyCompany("iText Group NV")]
910
[assembly: AssemblyProduct("iTextSharp")]
10-
[assembly: AssemblyCopyright("Copyright (C) 1999-2017 by iText Group NV")]
11+
[assembly: AssemblyCopyright("Copyright (C) 1999-2018 by iText Group NV")]
1112
[assembly: AssemblyTrademark("")]
1213
[assembly: AssemblyCulture("")]
1314
[assembly: InternalsVisibleTo("itextsharp.pdfa, PublicKey=00240000048000009400000006020000002400005253413100040000010001008b21ed5b3fc1c11996390981fe22bbe71a39a9e11d3c2cefddd6ee92920fa871f9666ae0fa941af0280d0653df048ae2d93f8c5e2d820dba3c8df9ed468c8be40a6fffeb32aa481a254f0fb9f37aa7c3ec1c0acd2c009746bbdafcb75bcdbcecb7caf1f0f4b6e7d013906ba60b66eb1c8298e4efb052caf6cece4bf1816902cc"),]
@@ -16,4 +17,6 @@
1617

1718
[assembly: ComVisibleAttribute(false)]
1819

19-
[assembly: AssemblyVersion("5.5.12")]
20+
[assembly: KeyVersion("3.0.1.0")]
21+
[assembly: AssemblyVersion("5.5.13")]
22+
[assembly: AssemblyInformationalVersion("5.5.13")]

src/core/KeyVersionAttribute.cs

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
This file is part of the iText (R) project.
3+
Copyright (c) 1998-2018 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+
45+
namespace Versions.Attributes {
46+
[AttributeUsage(AttributeTargets.Assembly)]
47+
internal class KeyVersionAttribute : Attribute {
48+
private string keyVersion;
49+
50+
internal string KeyVersion {
51+
get { return keyVersion; }
52+
private set { keyVersion = value; }
53+
}
54+
55+
internal KeyVersionAttribute(string keyVersion) {
56+
this.KeyVersion = keyVersion;
57+
}
58+
}
59+
}

src/core/iTextSharp/text/Version.cs

Lines changed: 83 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ source product.
4141
4242
*/
4343
using System;
44+
using System.IO;
4445
using System.Reflection;
46+
using iTextSharp.text.log;
47+
using Versions.Attributes;
4548

4649
namespace iTextSharp.text {
4750

@@ -72,22 +75,60 @@ public sealed class Version {
7275
* This String contains the version number of this iText release.
7376
* For debugging purposes, we request you NOT to change this constant.
7477
*/
75-
static private String release = "5.5.12";
78+
static private String release = "5.5.13";
7679

7780
/**
7881
* This String contains the iText version as shown in the producer line.
7982
* iText is a product developed by iText Group NV.
8083
* iText Group requests that you retain the iText producer line
8184
* in every PDF that is created or manipulated using iText.
8285
*/
83-
private String iTextVersion = iText + " " + release + " \u00a92000-2017 iText Group NV";
86+
private String iTextVersion = iText + " " + release + " \u00a92000-2018 iText Group NV";
8487

8588
/**
8689
* The license key.
8790
*/
8891
private String key = null;
89-
90-
/**
92+
93+
private static Type GetLicenseKeyClass() {
94+
String licenseKeyClassPartialName = "iText.License.LicenseKey, itext.licensekey";
95+
String licenseKeyClassFullName = null;
96+
97+
object[] keyVersionAttrs = typeof(Version).Assembly.GetCustomAttributes(typeof(KeyVersionAttribute), false);
98+
object keyVersionAttr = keyVersionAttrs.Length > 0 ? keyVersionAttrs[0] : null;
99+
if (keyVersionAttr is KeyVersionAttribute) {
100+
String keyVersion = ((KeyVersionAttribute) keyVersionAttr).KeyVersion;
101+
String format = "{0}, Version={1}, Culture=neutral, PublicKeyToken=8354ae6d2174ddca";
102+
licenseKeyClassFullName = String.Format(format, licenseKeyClassPartialName, keyVersion);
103+
}
104+
105+
Type type = null;
106+
if (licenseKeyClassFullName != null) {
107+
String fileLoadExceptionMessage = null;
108+
try {
109+
type = System.Type.GetType(licenseKeyClassFullName);
110+
}
111+
catch (FileLoadException fileLoadException) {
112+
fileLoadExceptionMessage = fileLoadException.Message;
113+
}
114+
115+
if (fileLoadExceptionMessage != null) {
116+
ILogger logger = LoggerFactory.GetLogger(typeof(Version));
117+
try {
118+
type = System.Type.GetType(licenseKeyClassPartialName);
119+
}
120+
catch {
121+
// ignore
122+
}
123+
if (type == null) {
124+
logger.Error(fileLoadExceptionMessage);
125+
}
126+
}
127+
}
128+
return type;
129+
}
130+
131+
/**
91132
* Gets an instance of the iText version that is currently used.
92133
* Note that iText Group requests that you retain the iText producer line
93134
* in every PDF that is created or manipulated using iText.
@@ -97,41 +138,44 @@ public static Version GetInstance() {
97138
version = new Version();
98139
lock (version) {
99140
try {
100-
Type type = Type.GetType("iTextSharp.license.LicenseKey, itextsharp.LicenseKey");
101-
MethodInfo m = type.GetMethod("GetLicenseeInfo");
102-
String[] info = (String[]) m.Invoke(Activator.CreateInstance(type), null);
103-
if (info[3] != null && info[3].Trim().Length > 0) {
104-
version.key = info[3];
105-
} else {
106-
version.key = "Trial version ";
107-
if (info[5] == null) {
108-
version.key += "unauthorised";
109-
} else {
110-
version.key += info[5];
111-
}
112-
}
113-
if (info[4] != null && info[4].Trim().Length > 0) {
114-
version.iTextVersion = info[4];
115-
} else if (info[2] != null && info[2].Trim().Length > 0) {
116-
version.iTextVersion += " (" + info[2];
117-
if (!version.key.ToLower().StartsWith("trial")) {
118-
version.iTextVersion += "; licensed version)";
119-
} else {
120-
version.iTextVersion += "; " + version.key + ")";
121-
}
122-
} else if (info[0] != null && info[0].Trim().Length > 0) {
123-
// fall back to contact name, if company name is unavailable
124-
version.iTextVersion += " (" + info[0];
125-
if (!version.key.ToLower().StartsWith("trial")) {
126-
// we shouldn't have a licensed version without company name,
127-
// but let's account for it anyway
128-
version.iTextVersion += "; licensed version)";
129-
} else {
130-
version.iTextVersion += "; " + version.key + ")";
131-
}
132-
} else {
133-
throw new Exception();
134-
}
141+
Type type = GetLicenseKeyClass();
142+
Type[] cArg = new Type[] {typeof(String)};
143+
MethodInfo m = type.GetMethod("GetLicenseeInfoForVersion", cArg);
144+
String coreVersion = release;
145+
Object[] args = new Object[] {coreVersion};
146+
String[] info = (String[]) m.Invoke(Activator.CreateInstance(type), args);
147+
if (info[3] != null && info[3].Trim().Length > 0) {
148+
version.key = info[3];
149+
} else {
150+
version.key = "Trial version ";
151+
if (info[5] == null) {
152+
version.key += "unauthorised";
153+
} else {
154+
version.key += info[5];
155+
}
156+
}
157+
if (info[4] != null && info[4].Trim().Length > 0) {
158+
version.iTextVersion = info[4];
159+
} else if (info[2] != null && info[2].Trim().Length > 0) {
160+
version.iTextVersion += " (" + info[2];
161+
if (!version.key.ToLower().StartsWith("trial")) {
162+
version.iTextVersion += "; licensed version)";
163+
} else {
164+
version.iTextVersion += "; " + version.key + ")";
165+
}
166+
} else if (info[0] != null && info[0].Trim().Length > 0) {
167+
// fall back to contact name, if company name is unavailable
168+
version.iTextVersion += " (" + info[0];
169+
if (!version.key.ToLower().StartsWith("trial")) {
170+
// we shouldn't have a licensed version without company name,
171+
// but let's account for it anyway
172+
version.iTextVersion += "; licensed version)";
173+
} else {
174+
version.iTextVersion += "; " + version.key + ")";
175+
}
176+
} else {
177+
throw new Exception();
178+
}
135179
} catch (Exception) {
136180
version.iTextVersion += AGPL;
137181
}

src/core/iTextSharp/text/error_messages/en.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,7 @@ path.construction.operator.inside.text.object=Path construction or drawing opera
514514
unbalanced.layer.operators=Unbalanced layer operators.
515515
unbalanced.marked.content.operators=Unbalanced marked content operators.
516516
unbalanced.save.restore.state.operators=Unbalanced save/restore state operators.
517+
unexpected.color.space.in.embedded.icc.profile=Unexpected color space in embedded ICC Profile. It will be ignored.
517518
unexpected.end.of.file=Unexpected end of file.
518519
unexpected.eof=Unexpected EOF
519520
unexpected.gt.gt=Unexpected '>>'

src/core/iTextSharp/text/error_messages/nl.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,7 @@ path.construction.operator.inside.text.object=Pad constructie of drawing operato
514514
unbalanced.layer.operators=Ongebalanceerde operatoren voor layers.
515515
unbalanced.marked.content.operators=Ongebalanceerde marked content operatoren.
516516
unbalanced.save.restore.state.operators=Ongebalanceerde save/restore state operatoren.
517+
unexpected.color.space.in.embedded.icc.profile=Onverwachte kleurenruimte in ingesloten ICC-profiel. Het zal worden genegeerd.
517518
unexpected.end.of.file=Onverwacht einde van het bestand.
518519
unexpected.eof=Onverwachte EOF
519520
unexpected.gt.gt=Onverwachte '>>'

src/core/iTextSharp/text/pdf/BarcodePDF417.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@ virtual public void PaintCode() {
857857
pad = tot - lenErr - lenCodewords;
858858
if ((options & PDF417_USE_MACRO) != 0) {
859859
// the padding comes before the control block
860-
System.Array.Copy(codewords, macroIndex, codewords, macroIndex + pad, pad);
860+
System.Array.Copy(codewords, macroIndex, codewords, macroIndex + pad, lenCodewords - macroIndex);
861861
cwPtr = lenCodewords + pad;
862862
while (pad-- != 0)
863863
codewords[macroIndex++] = TEXT_MODE;

src/core/iTextSharp/text/pdf/PdfStamperImp.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ virtual internal protected void FlatFields() {
979979
}
980980
}
981981
}
982-
else if (appDic != null && as_n != null) {
982+
else if (appDic != null && as_n != null && (as_n.IsStream() || as_n.IsDictionary())) {
983983
PdfArray bbox = ((PdfDictionary)as_n).GetAsArray(PdfName.BBOX);
984984
PdfArray rect = merged.GetAsArray(PdfName.RECT);
985985
if (bbox != null && rect != null) {

src/core/iTextSharp/text/pdf/codec/PngImage.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,7 @@ PdfObject GetColorspace() {
456456

457457
Image GetImage() {
458458
ReadPng();
459+
CheckIccProfile();
459460
int pal0 = 0;
460461
int palIdx = 0;
461462
palShades = false;
@@ -813,6 +814,22 @@ int[] GetPixel(byte[] curr) {
813814
}
814815
}
815816

817+
private int GetExpectedIccNumberOfComponents() {
818+
if (colorType == 0 || colorType == 4) {
819+
return 1;
820+
} else {
821+
return 3;
822+
}
823+
}
824+
825+
private void CheckIccProfile() {
826+
if (icc_profile != null && icc_profile.NumComponents != GetExpectedIccNumberOfComponents()) {
827+
LoggerFactory.GetLogger(typeof(PngImage)).Warn(MessageLocalization.GetComposedMessage("unexpected.color.space.in.embedded.icc.profile"));
828+
icc_profile = null;
829+
}
830+
}
831+
832+
816833
private static void DecodeSubFilter(byte[] curr, int count, int bpp) {
817834
for (int i = bpp; i < count; i++) {
818835
int val;

0 commit comments

Comments
 (0)