Skip to content

Commit

Permalink
Merge branch 'release/5.5.13'
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-alay committed Jan 22, 2018
2 parents af371da + 18237aa commit 2304b47
Show file tree
Hide file tree
Showing 36 changed files with 634 additions and 284 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,9 @@ $RECYCLE.BIN/
target/
nbactions*.xml
src/core/iTextSharp.xml

# JetBrains Rider
.idea/

#Linux files
.directory
2 changes: 1 addition & 1 deletion src/BuildAll(VS2010).sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "itext-hyph-xml(VS2010)", "e
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "itextsharp.xmlworker(VS2010)", "extras\itextsharp.xmlworker\itextsharp.xmlworker(VS2010).csproj", "{96647204-4A3E-41D7-BC74-B1608D6D1857}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "itextsharp.xtra(VS2010)", "extras\itextsharp.xtra\itextsharp.xtra(VS2010).csproj", "{BE1934CF-90A9-43D3-A794-7E540874EDBB}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "iTextSharp.xtra(VS2010)", "extras\iTextSharp.xtra\iTextSharp.xtra(VS2010).csproj", "{BE1934CF-90A9-43D3-A794-7E540874EDBB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "iTextAsian(VS2010)", "extras\iTextAsian\iTextAsian(VS2010).csproj", "{2F467830-A94B-4C44-B17B-0A81CBDB8CB2}"
EndProject
Expand Down
2 changes: 1 addition & 1 deletion src/BuildAll.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "itext-hyph-xml", "extras\it
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "itextsharp.xmlworker", "extras\itextsharp.xmlworker\itextsharp.xmlworker.csproj", "{96647204-4A3E-41D7-BC74-B1608D6D1857}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "itextsharp.xtra", "extras\itextsharp.xtra\itextsharp.xtra.csproj", "{BE1934CF-90A9-43D3-A794-7E540874EDBB}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "itextsharp.xtra", "extras\iTextSharp.xtra\iTextSharp.xtra.csproj", "{BE1934CF-90A9-43D3-A794-7E540874EDBB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "iTextAsian", "extras\iTextAsian\iTextAsian.csproj", "{2F467830-A94B-4C44-B17B-0A81CBDB8CB2}"
EndProject
Expand Down
7 changes: 5 additions & 2 deletions src/core/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Versions.Attributes;

[assembly: AssemblyTitle("iTextSharp")]
[assembly: AssemblyDescription("A free PDF library ported from Java iText.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("iText Group NV")]
[assembly: AssemblyProduct("iTextSharp")]
[assembly: AssemblyCopyright("Copyright (C) 1999-2017 by iText Group NV")]
[assembly: AssemblyCopyright("Copyright (C) 1999-2018 by iText Group NV")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: InternalsVisibleTo("itextsharp.pdfa, PublicKey=00240000048000009400000006020000002400005253413100040000010001008b21ed5b3fc1c11996390981fe22bbe71a39a9e11d3c2cefddd6ee92920fa871f9666ae0fa941af0280d0653df048ae2d93f8c5e2d820dba3c8df9ed468c8be40a6fffeb32aa481a254f0fb9f37aa7c3ec1c0acd2c009746bbdafcb75bcdbcecb7caf1f0f4b6e7d013906ba60b66eb1c8298e4efb052caf6cece4bf1816902cc"),]
Expand All @@ -16,4 +17,6 @@

[assembly: ComVisibleAttribute(false)]

[assembly: AssemblyVersion("5.5.12")]
[assembly: KeyVersion("3.0.1.0")]
[assembly: AssemblyVersion("5.5.13")]
[assembly: AssemblyInformationalVersion("5.5.13")]
59 changes: 59 additions & 0 deletions src/core/KeyVersionAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
This file is part of the iText (R) project.
Copyright (c) 1998-2018 iText Group NV
Authors: iText Software.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License version 3
as published by the Free Software Foundation with the addition of the
following permission added to Section 15 as permitted in Section 7(a):
FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY
ITEXT GROUP. ITEXT GROUP DISCLAIMS THE WARRANTY OF NON INFRINGEMENT
OF THIRD PARTY RIGHTS
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program; if not, see http://www.gnu.org/licenses or write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA, 02110-1301 USA, or download the license from the following URL:
http://itextpdf.com/terms-of-use/
The interactive user interfaces in modified source and object code versions
of this program must display Appropriate Legal Notices, as required under
Section 5 of the GNU Affero General Public License.
In accordance with Section 7(b) of the GNU Affero General Public License,
a covered work must retain the producer line in every PDF that is created
or manipulated using iText.
You can be released from the requirements of the license by purchasing
a commercial license. Buying such a license is mandatory as soon as you
develop commercial activities involving the iText software without
disclosing the source code of your own applications.
These activities include: offering paid services to customers as an ASP,
serving PDFs on the fly in a web application, shipping iText with a closed
source product.
For more information, please contact iText Software Corp. at this
address: [email protected]
*/
using System;

namespace Versions.Attributes {
[AttributeUsage(AttributeTargets.Assembly)]
internal class KeyVersionAttribute : Attribute {
private string keyVersion;

internal string KeyVersion {
get { return keyVersion; }
private set { keyVersion = value; }
}

internal KeyVersionAttribute(string keyVersion) {
this.KeyVersion = keyVersion;
}
}
}
122 changes: 83 additions & 39 deletions src/core/iTextSharp/text/Version.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ source product.
address: [email protected]
*/
using System;
using System.IO;
using System.Reflection;
using iTextSharp.text.log;
using Versions.Attributes;

namespace iTextSharp.text {

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

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

/**
* The license key.
*/
private String key = null;

/**

private static Type GetLicenseKeyClass() {
String licenseKeyClassPartialName = "iText.License.LicenseKey, itext.licensekey";
String licenseKeyClassFullName = null;

object[] keyVersionAttrs = typeof(Version).Assembly.GetCustomAttributes(typeof(KeyVersionAttribute), false);
object keyVersionAttr = keyVersionAttrs.Length > 0 ? keyVersionAttrs[0] : null;
if (keyVersionAttr is KeyVersionAttribute) {
String keyVersion = ((KeyVersionAttribute) keyVersionAttr).KeyVersion;
String format = "{0}, Version={1}, Culture=neutral, PublicKeyToken=8354ae6d2174ddca";
licenseKeyClassFullName = String.Format(format, licenseKeyClassPartialName, keyVersion);
}

Type type = null;
if (licenseKeyClassFullName != null) {
String fileLoadExceptionMessage = null;
try {
type = System.Type.GetType(licenseKeyClassFullName);
}
catch (FileLoadException fileLoadException) {
fileLoadExceptionMessage = fileLoadException.Message;
}

if (fileLoadExceptionMessage != null) {
ILogger logger = LoggerFactory.GetLogger(typeof(Version));
try {
type = System.Type.GetType(licenseKeyClassPartialName);
}
catch {
// ignore
}
if (type == null) {
logger.Error(fileLoadExceptionMessage);
}
}
}
return type;
}

/**
* Gets an instance of the iText version that is currently used.
* Note that iText Group requests that you retain the iText producer line
* in every PDF that is created or manipulated using iText.
Expand All @@ -97,41 +138,44 @@ public static Version GetInstance() {
version = new Version();
lock (version) {
try {
Type type = Type.GetType("iTextSharp.license.LicenseKey, itextsharp.LicenseKey");
MethodInfo m = type.GetMethod("GetLicenseeInfo");
String[] info = (String[]) m.Invoke(Activator.CreateInstance(type), null);
if (info[3] != null && info[3].Trim().Length > 0) {
version.key = info[3];
} else {
version.key = "Trial version ";
if (info[5] == null) {
version.key += "unauthorised";
} else {
version.key += info[5];
}
}
if (info[4] != null && info[4].Trim().Length > 0) {
version.iTextVersion = info[4];
} else if (info[2] != null && info[2].Trim().Length > 0) {
version.iTextVersion += " (" + info[2];
if (!version.key.ToLower().StartsWith("trial")) {
version.iTextVersion += "; licensed version)";
} else {
version.iTextVersion += "; " + version.key + ")";
}
} else if (info[0] != null && info[0].Trim().Length > 0) {
// fall back to contact name, if company name is unavailable
version.iTextVersion += " (" + info[0];
if (!version.key.ToLower().StartsWith("trial")) {
// we shouldn't have a licensed version without company name,
// but let's account for it anyway
version.iTextVersion += "; licensed version)";
} else {
version.iTextVersion += "; " + version.key + ")";
}
} else {
throw new Exception();
}
Type type = GetLicenseKeyClass();
Type[] cArg = new Type[] {typeof(String)};
MethodInfo m = type.GetMethod("GetLicenseeInfoForVersion", cArg);
String coreVersion = release;
Object[] args = new Object[] {coreVersion};
String[] info = (String[]) m.Invoke(Activator.CreateInstance(type), args);
if (info[3] != null && info[3].Trim().Length > 0) {
version.key = info[3];
} else {
version.key = "Trial version ";
if (info[5] == null) {
version.key += "unauthorised";
} else {
version.key += info[5];
}
}
if (info[4] != null && info[4].Trim().Length > 0) {
version.iTextVersion = info[4];
} else if (info[2] != null && info[2].Trim().Length > 0) {
version.iTextVersion += " (" + info[2];
if (!version.key.ToLower().StartsWith("trial")) {
version.iTextVersion += "; licensed version)";
} else {
version.iTextVersion += "; " + version.key + ")";
}
} else if (info[0] != null && info[0].Trim().Length > 0) {
// fall back to contact name, if company name is unavailable
version.iTextVersion += " (" + info[0];
if (!version.key.ToLower().StartsWith("trial")) {
// we shouldn't have a licensed version without company name,
// but let's account for it anyway
version.iTextVersion += "; licensed version)";
} else {
version.iTextVersion += "; " + version.key + ")";
}
} else {
throw new Exception();
}
} catch (Exception) {
version.iTextVersion += AGPL;
}
Expand Down
1 change: 1 addition & 0 deletions src/core/iTextSharp/text/error_messages/en.lng
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,7 @@ path.construction.operator.inside.text.object=Path construction or drawing opera
unbalanced.layer.operators=Unbalanced layer operators.
unbalanced.marked.content.operators=Unbalanced marked content operators.
unbalanced.save.restore.state.operators=Unbalanced save/restore state operators.
unexpected.color.space.in.embedded.icc.profile=Unexpected color space in embedded ICC Profile. It will be ignored.
unexpected.end.of.file=Unexpected end of file.
unexpected.eof=Unexpected EOF
unexpected.gt.gt=Unexpected '>>'
Expand Down
1 change: 1 addition & 0 deletions src/core/iTextSharp/text/error_messages/nl.lng
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,7 @@ path.construction.operator.inside.text.object=Pad constructie of drawing operato
unbalanced.layer.operators=Ongebalanceerde operatoren voor layers.
unbalanced.marked.content.operators=Ongebalanceerde marked content operatoren.
unbalanced.save.restore.state.operators=Ongebalanceerde save/restore state operatoren.
unexpected.color.space.in.embedded.icc.profile=Onverwachte kleurenruimte in ingesloten ICC-profiel. Het zal worden genegeerd.
unexpected.end.of.file=Onverwacht einde van het bestand.
unexpected.eof=Onverwachte EOF
unexpected.gt.gt=Onverwachte '>>'
Expand Down
2 changes: 1 addition & 1 deletion src/core/iTextSharp/text/pdf/BarcodePDF417.cs
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ virtual public void PaintCode() {
pad = tot - lenErr - lenCodewords;
if ((options & PDF417_USE_MACRO) != 0) {
// the padding comes before the control block
System.Array.Copy(codewords, macroIndex, codewords, macroIndex + pad, pad);
System.Array.Copy(codewords, macroIndex, codewords, macroIndex + pad, lenCodewords - macroIndex);
cwPtr = lenCodewords + pad;
while (pad-- != 0)
codewords[macroIndex++] = TEXT_MODE;
Expand Down
2 changes: 1 addition & 1 deletion src/core/iTextSharp/text/pdf/PdfStamperImp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ virtual internal protected void FlatFields() {
}
}
}
else if (appDic != null && as_n != null) {
else if (appDic != null && as_n != null && (as_n.IsStream() || as_n.IsDictionary())) {
PdfArray bbox = ((PdfDictionary)as_n).GetAsArray(PdfName.BBOX);
PdfArray rect = merged.GetAsArray(PdfName.RECT);
if (bbox != null && rect != null) {
Expand Down
17 changes: 17 additions & 0 deletions src/core/iTextSharp/text/pdf/codec/PngImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ PdfObject GetColorspace() {

Image GetImage() {
ReadPng();
CheckIccProfile();
int pal0 = 0;
int palIdx = 0;
palShades = false;
Expand Down Expand Up @@ -813,6 +814,22 @@ int[] GetPixel(byte[] curr) {
}
}

private int GetExpectedIccNumberOfComponents() {
if (colorType == 0 || colorType == 4) {
return 1;
} else {
return 3;
}
}

private void CheckIccProfile() {
if (icc_profile != null && icc_profile.NumComponents != GetExpectedIccNumberOfComponents()) {
LoggerFactory.GetLogger(typeof(PngImage)).Warn(MessageLocalization.GetComposedMessage("unexpected.color.space.in.embedded.icc.profile"));
icc_profile = null;
}
}


private static void DecodeSubFilter(byte[] curr, int count, int bpp) {
for (int i = bpp; i < count; i++) {
int val;
Expand Down
Loading

0 comments on commit 2304b47

Please sign in to comment.