Skip to content

Commit 20eb242

Browse files
committed
[RELEASE] iText 7 pdfOcr - 1.0.3
https://git.itextsupport.com/ * release_branch_DEVSIX-5154: [RELEASE] pdfOCR 1.0.3 Add PdfDocument constructor to try-with-resources Use ImageTypeDetector's stream overload Consider image's type from its data rather than its extension Update dependencies Update port-hash Drop .NET Framework 4.0 support in favor of 4.5 in itextcore modules Update copyright year to 2021 in class headers Add missing copyright headers Update dependencies [RELEASE] Update dependency versions Update port-hash Update port-hash Update autoported files Remove unused references Delete unusage constants Update netstandard version to 2.0 Update port-hash Update autoported files Add CONTRIBUTING.md with latest information and links Get rid of using "LicenseKeyProductFeature" in ReflectionUtils class in pdfOCR Update port-hash Update port-hash Update port-hash after release [RELEASE] Update licensekey dependency Update port-hash after release [RELEASE] Update dependency versions
2 parents 6386958 + 8387ba4 commit 20eb242

File tree

99 files changed

+505
-211
lines changed

Some content is hidden

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

99 files changed

+505
-211
lines changed

CONTRIBUTING.md

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
# Contributing to iText 7 Community
2+
3+
We'd love for you to contribute to our source code and to make **iText 7 Community** even better than it is
4+
today! Here are the guidelines we'd like you to follow:
5+
6+
- [Question or Problem?](#question)
7+
- [Issues and Bugs](#issue)
8+
- [New Features](#feature)
9+
- [Submission Guidelines](#submit)
10+
- [Coding Rules](#rules)
11+
- [Commit Message Guidelines](#commit)
12+
- [Signing the iCLA](#cla)
13+
- [Contributor Code of Conduct](#coc)
14+
15+
16+
## <a name="question">Got a Question or Problem?</a>
17+
18+
If you have questions about how to use **iText 7 Community**, please direct these to [Stack Overflow][stackoverflow].
19+
20+
If you are a customer with a [support agreement][support], you also have direct access to our JIRA and our developers.
21+
22+
23+
## <a name="issue">Found an Issue?</a>
24+
If you find a bug in the source code or a mistake in the documentation, you can help us by
25+
submitting a [Pull Request][pull] with a fix.
26+
27+
**Please see the [Submission Guidelines](#submit) below**.
28+
29+
30+
## <a name="feature">Want to implement a Feature?</a>
31+
If you would like to implement a new feature then consider what kind of change it is:
32+
33+
* **Major Changes** that you wish to contribute to the project should be discussed first so that we can better
34+
coordinate our efforts, prevent duplication of work, and help you to craft the change so that it is successfully
35+
accepted into the project. Contact us at [[email protected]](mailto:[email protected]).
36+
* **Small Changes** can be crafted and submitted to the [GitHub Repository][github] as a [Pull Request][pull].
37+
38+
39+
## <a name="submit">Submission Guidelines</a>
40+
41+
### Submitting a Question or an Issue
42+
Before you submit your question or issue, search [Stack Overflow][stackoverflow], maybe your question was already answered.
43+
44+
If your issue appears to be a bug, and hasn't been reported, ask a question on [Stack Overflow][stackoverflow] to verify that is indeed a bug and not a mistake in your own code.
45+
Help us to maximize the effort we can spend fixing issues and adding new
46+
features, by not reporting duplicate issues. Providing the following information will increase the
47+
chances of your issue being dealt with quickly:
48+
49+
* **[How to ask good questions][good-questions]**
50+
* **Overview of the Issue** - if an error is being thrown a non-minified stack trace helps
51+
* **Motivation for or Use Case** - explain why this is a bug for you
52+
* **iText Version(s)** - is it a regression?
53+
* **Operating System** - is this a problem on Windows or Linux, maybe on Mac?
54+
* **Reproduce the Error** - provide a [Short, Self Contained, Correct (Compilable), Example][sscce], also known as a [Minimal, Complete, and Verifiable example][mcve].
55+
* **Related Issues** - has a similar issue been reported before?
56+
* **Suggest a Fix** - if you can't fix the bug yourself, perhaps you can point to what might be
57+
causing the problem (line of code or commit)
58+
* **Tag the question** - add the tag `itext7` to your question so we can find it.
59+
60+
**If you get help, help others. Good karma rulez!**
61+
62+
63+
### Submitting a Pull Request
64+
Before you submit your pull request consider the following guidelines:
65+
66+
* Search [GitHub][pull] for an open or closed Pull Request
67+
that relates to your submission. You don't want to duplicate effort.
68+
* Verify that your proposed change hasn't already been addressed in the develop branch.
69+
* Don't send a separate pull request for every single file you change.
70+
* Please sign the [iText Contributor License Agreement (iCLA)](#cla) before sending pull
71+
requests. We cannot accept code without this agreement.
72+
* Fork the iText repository on GitHub.
73+
* Clone your iText fork to your local machine.
74+
* Make your changes, **including appropriate test cases**.
75+
* Follow our [Coding Rules](#rules).
76+
* Commit your changes using a descriptive commit message that follows our
77+
[commit message conventions](#commit-message-format).
78+
* Now would be a good time to fix up your commits (if you want or need to) with `git rebase --interactive`.
79+
* Build your changes locally to ensure all the tests pass.
80+
* Push your changes to your GitHub account.
81+
* Create a pull request in GitHub.
82+
"Head fork" should be your repository, and the "base fork" should be the iText7 official repository.
83+
* If we suggest changes then:
84+
* Make the required updates.
85+
* Fix up your commits if needed, with an interactive rebase.
86+
* Re-run the tests and make sure that they are still passing.
87+
* Force push to your GitHub repository. This will update your Pull Request.
88+
89+
That's it! Thank you for your contribution!
90+
91+
#### After your pull request is merged
92+
93+
After your pull request is merged, you can safely delete your fork and pull the changes
94+
from the main (upstream) repository.
95+
96+
97+
## <a name="rules">Coding Rules</a>
98+
To ensure consistency throughout the source code, keep these rules in mind as you are working:
99+
100+
* We develop in Java first, and then port to .NET, so code submissions in Java are preferred.
101+
Nevertheless this shouldn't stop you from making a good pull request to the .NET port.
102+
* All features or bug fixes **must be tested** by one or more unit tests.
103+
* All public API methods **must be documented** with JavaDoc. To see how we document our APIs, please check
104+
out the existing [javadocs][javadocs].
105+
* We follow the rules contained in
106+
[Oracle's Code Conventions for the Java Programming Language][java-style-guide], with these additions:
107+
* Wrap all code at **100 characters**.
108+
109+
110+
## <a name="commit">Git Commit Guidelines</a>
111+
112+
We have guidelines on how our git commit messages should be formatted. This leads to **more
113+
readable messages** that are easy to follow when looking through the **project history**. But also,
114+
we use the git commit messages to **generate the iText 7 Community change log**.
115+
116+
These guidelines were taken from Chris Beams' blog post [How to Write a Git Commit Message][git-commit].
117+
118+
### Commit Message Format
119+
Each commit message consists of a **subject**, a **body** and a **footer**:
120+
121+
```
122+
<subject>
123+
<BLANK LINE>
124+
<body>
125+
<BLANK LINE>
126+
<footer>
127+
```
128+
129+
Any line of the commit message should not be longer 72 characters! This allows the message to be easier
130+
to read on GitHub as well as in various git tools.
131+
132+
### Subject
133+
The subject contains succinct description of the change:
134+
135+
* [Separate subject from body with a blank line][git-commit-separate]
136+
* [Limit the subject line to 50 characters][git-commit-limit-50]
137+
* [Capitalize the subject line][git-commit-capitalize]
138+
* [Do not end the subject line with a period][git-commit-end]
139+
* [Use the imperative mood in the subject line][git-commit-imperative]
140+
141+
### Body
142+
* [Wrap the body at 72 characters][git-commit-wrap-72]
143+
* [Use the body to explain _what_ and _why_ vs. _how_][git-commit-why-not-how]
144+
145+
### Footer
146+
The footer contains any information about **Breaking Changes** and is also the place to
147+
reference JIRA or GitHub issues that this commit **Closes**.
148+
149+
150+
## <a name="cla">Signing the iCLA</a>
151+
152+
Please sign the [**iText Contributor License Agreement (iCLA)**][cla] before sending pull requests. For any code changes to be accepted, the iCLA must be signed. It's a quick process, we promise!
153+
154+
We'll need you to [(digitally) sign and then email, fax or mail the form][cla].
155+
156+
157+
## <a name="coc">Contributor Code of Conduct</a>
158+
Please note that this project is released with a [Contributor Code of Conduct][coc]. By participating in this project you agree to abide by its terms.
159+
160+
We use the [Stack Exchange][stackoverflow] network for free support and [GitHub][github] for code hosting. By using these services, you agree to abide by their terms:
161+
162+
* StackExchange: [http://stackexchange.com/legal](http://stackexchange.com/legal)
163+
* Github: [https://help.github.com/articles/github-terms-of-service/](https://help.github.com/articles/github-terms-of-service/)
164+
165+
[cla]: https://itextpdf.com/en/how-buy/legal/itext-contributor-license-agreement
166+
[coc]: CODE_OF_CONDUCT.md
167+
[github]: https://github.com/itext/i7n-pdfocr
168+
[java-style-guide]: https://www.oracle.com/technetwork/java/codeconvtoc-136057.html
169+
[javadocs]: https://itextpdf.com/api
170+
[pull]: https://github.com/itext/i7n-pdfocr/pulls
171+
[sscce]: http://sscce.org/
172+
[stackoverflow]: https://stackoverflow.com/questions/tagged/itext7
173+
[good-questions]: https://stackoverflow.com/help/how-to-ask
174+
[mcve]: https://stackoverflow.com/help/mcve
175+
[support]: https://itextpdf.com/support
176+
[git-commit]: https://chris.beams.io/posts/git-commit/
177+
[git-commit-separate]: https://chris.beams.io/posts/git-commit/#separate
178+
[git-commit-limit-50]: https://chris.beams.io/posts/git-commit/#limit-50
179+
[git-commit-capitalize]: https://chris.beams.io/posts/git-commit/#capitalize
180+
[git-commit-end]: https://chris.beams.io/posts/git-commit/#end
181+
[git-commit-imperative]: https://chris.beams.io/posts/git-commit/#imperative
182+
[git-commit-wrap-72]: https://chris.beams.io/posts/git-commit/#wrap-72
183+
[git-commit-why-not-how]: https://chris.beams.io/posts/git-commit/#why-not-how

Jenkinsfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
def repoName = "pdfOcr"
55
def dependencyRegex = "itextcore"
66
def solutionFile = "i7n-ocr.sln"
7+
def csprojFramework = "netcoreapp2.0"
78

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

doxyfile

Lines changed: 1 addition & 1 deletion
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 = "pdfOCR 1.0.2 API"
35+
PROJECT_NAME = "pdfOCR 1.0.3 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.tests/itext.pdfocr.api.tests/Properties/AssemblyInfo.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
[assembly: AssemblyConfiguration("")]
88
[assembly: AssemblyCompany("iText Group NV")]
99
[assembly: AssemblyProduct("iText")]
10-
[assembly: AssemblyCopyright ("Copyright (c) 1998-2020 iText Group NV")]
10+
[assembly: AssemblyCopyright ("Copyright (c) 1998-2021 iText Group NV")]
1111
[assembly: AssemblyTrademark("")]
1212
[assembly: AssemblyCulture("")]
1313

1414
[assembly: ComVisible(false)]
1515

1616
[assembly: Guid("d6a6ea97-1f23-448f-b700-eff62971d234")]
1717

18-
[assembly: AssemblyVersion("1.0.2.0")]
19-
[assembly: AssemblyFileVersion("1.0.2.0")]
20-
[assembly: AssemblyInformationalVersion("1.0.2")]
18+
[assembly: AssemblyVersion("1.0.3.0")]
19+
[assembly: AssemblyFileVersion("1.0.3.0")]
20+
[assembly: AssemblyInformationalVersion("1.0.3")]

itext.tests/itext.pdfocr.api.tests/itext.pdfocr.api.tests.csproj

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,23 @@
99
<OutputType>library</OutputType>
1010
</PropertyGroup>
1111
<PropertyGroup>
12-
<TargetFramework>net40</TargetFramework>
12+
<TargetFramework>net45</TargetFramework>
1313
</PropertyGroup>
1414
<PropertyGroup>
1515
<SignAssembly>true</SignAssembly>
1616
<DelaySign>False</DelaySign>
1717
<AssemblyOriginatorKeyFile>itext.snk</AssemblyOriginatorKeyFile>
1818
</PropertyGroup>
1919
<ItemGroup>
20-
<Reference Include="Microsoft.CSharp" />
2120
<Reference Include="System" />
2221
<Reference Include="System.Core" />
23-
<Reference Include="System.Drawing" />
2422
</ItemGroup>
2523
<ItemGroup>
2624
<None Include="itext.snk" />
2725
</ItemGroup>
2826
<ItemGroup>
2927
<ProjectReference Include="..\..\..\itextcore\itext\itext.pdftest\itext.pdftest.netstandard.csproj" Condition="Exists('..\..\..\itextcore\itext\itext.pdftest\itext.pdftest.netstandard.csproj')" />
30-
<PackageReference Include="itext7.pdftest" Version="7.1.13" Condition="!Exists('..\..\..\itextcore\itext\itext.pdftest\itext.pdftest.netstandard.csproj')" />
28+
<PackageReference Include="itext7.pdftest" Version="7.1.16" Condition="!Exists('..\..\..\itextcore\itext\itext.pdftest\itext.pdftest.netstandard.csproj')" />
3129
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.0" />
3230
<PackageReference Include="NUnit" Version="3.12.0" />
3331
<PackageReference Include="NUnit3TestAdapter" Version="3.16.1">
@@ -38,4 +36,4 @@
3836
<ItemGroup>
3937
<ProjectReference Include="..\..\itext\itext.pdfocr.api\itext.pdfocr.api.csproj" />
4038
</ItemGroup>
41-
</Project>
39+
</Project>

itext.tests/itext.pdfocr.api.tests/itext/metainfo/TestMetaInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
This file is part of the iText (R) project.
3-
Copyright (c) 1998-2020 iText Group NV
3+
Copyright (c) 1998-2021 iText Group NV
44
Authors: iText Software.
55
66
This program is offered under a commercial and under the AGPL license.

itext.tests/itext.pdfocr.api.tests/itext/pdfocr/ApiTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
This file is part of the iText (R) project.
3-
Copyright (c) 1998-2020 iText Group NV
3+
Copyright (c) 1998-2021 iText Group NV
44
Authors: iText Software.
55
66
This program is offered under a commercial and under the AGPL license.

itext.tests/itext.pdfocr.api.tests/itext/pdfocr/PdfA3uTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
This file is part of the iText (R) project.
3-
Copyright (c) 1998-2020 iText Group NV
3+
Copyright (c) 1998-2021 iText Group NV
44
Authors: iText Software.
55
66
This program is offered under a commercial and under the AGPL license.
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/*
2+
This file is part of the iText (R) project.
3+
Copyright (c) 1998-2021 iText Group NV
4+
Authors: iText Software.
5+
6+
This program is offered under a commercial and under the AGPL license.
7+
For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below.
8+
9+
AGPL licensing:
10+
This program is free software: you can redistribute it and/or modify
11+
it under the terms of the GNU Affero General Public License as published by
12+
the Free Software Foundation, either version 3 of the License, or
13+
(at your option) any later version.
14+
15+
This program is distributed in the hope that it will be useful,
16+
but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
GNU Affero General Public License for more details.
19+
20+
You should have received a copy of the GNU Affero General Public License
21+
along with this program. If not, see <https://www.gnu.org/licenses/>.
22+
*/
23+
using System.Collections.Generic;
24+
using System.IO;
25+
using iText.IO.Image;
26+
using iText.IO.Util;
27+
using iText.Pdfocr.Helpers;
28+
using iText.Test;
29+
using iText.Test.Attributes;
30+
31+
namespace iText.Pdfocr {
32+
public class PdfCreatorUtilTest : ExtendedITextTest {
33+
[NUnit.Framework.Test]
34+
public virtual void GetImageDataFromValidSinglePagedTiffTest() {
35+
FileInfo image = new FileInfo(PdfHelper.GetImagesTestDirectory() + "single7x5cm.tif");
36+
IList<ImageData> images = PdfCreatorUtil.GetImageData(image, null);
37+
NUnit.Framework.Assert.AreEqual(1, images.Count);
38+
ImageData imageDate = images[0];
39+
NUnit.Framework.Assert.IsNotNull(imageDate);
40+
NUnit.Framework.Assert.IsTrue(imageDate is TiffImageData);
41+
NUnit.Framework.Assert.AreEqual(ImageType.TIFF, imageDate.GetOriginalType());
42+
}
43+
44+
[NUnit.Framework.Test]
45+
public virtual void GetImageDataFromValidMultiPagedTiffTest() {
46+
FileInfo image = new FileInfo(PdfHelper.GetImagesTestDirectory() + "multipage.tiff");
47+
IList<ImageData> images = PdfCreatorUtil.GetImageData(image, null);
48+
NUnit.Framework.Assert.AreEqual(9, images.Count);
49+
foreach (ImageData imageDate in images) {
50+
NUnit.Framework.Assert.IsNotNull(imageDate);
51+
NUnit.Framework.Assert.IsTrue(imageDate is TiffImageData);
52+
NUnit.Framework.Assert.AreEqual(ImageType.TIFF, imageDate.GetOriginalType());
53+
}
54+
}
55+
56+
[NUnit.Framework.Test]
57+
public virtual void GetImageDataFromValidNotTiffTest() {
58+
FileInfo image = new FileInfo(PdfHelper.GetImagesTestDirectory() + "numbers_01.jpg");
59+
IList<ImageData> images = PdfCreatorUtil.GetImageData(image, null);
60+
NUnit.Framework.Assert.AreEqual(1, images.Count);
61+
ImageData imageDate = images[0];
62+
NUnit.Framework.Assert.IsNotNull(imageDate);
63+
NUnit.Framework.Assert.IsTrue(imageDate is JpegImageData);
64+
NUnit.Framework.Assert.AreEqual(ImageType.JPEG, imageDate.GetOriginalType());
65+
}
66+
67+
[NUnit.Framework.Test]
68+
[LogMessage(PdfOcrLogMessageConstant.CANNOT_READ_INPUT_IMAGE)]
69+
public virtual void GetImageDataFromNotExistingImageTest() {
70+
NUnit.Framework.Assert.That(() => {
71+
PdfCreatorUtil.GetImageData(new FileInfo("no such path"), null);
72+
}
73+
, NUnit.Framework.Throws.InstanceOf<OcrException>())
74+
;
75+
}
76+
77+
[NUnit.Framework.Test]
78+
[LogMessage(PdfOcrLogMessageConstant.CANNOT_READ_INPUT_IMAGE)]
79+
public virtual void GetImageDataFromInvalidImageTest() {
80+
NUnit.Framework.Assert.That(() => {
81+
PdfCreatorUtil.GetImageData(new FileInfo(PdfHelper.GetImagesTestDirectory() + "corrupted.jpg"), null);
82+
}
83+
, NUnit.Framework.Throws.InstanceOf<OcrException>().With.Message.EqualTo(MessageFormatUtil.Format(OcrException.CANNOT_READ_INPUT_IMAGE)))
84+
;
85+
}
86+
}
87+
}

itext.tests/itext.pdfocr.api.tests/itext/pdfocr/PdfFontTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
This file is part of the iText (R) project.
3-
Copyright (c) 1998-2020 iText Group NV
3+
Copyright (c) 1998-2021 iText Group NV
44
Authors: iText Software.
55
66
This program is offered under a commercial and under the AGPL license.

0 commit comments

Comments
 (0)