Skip to content

Commit d143306

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 Remove pdfbox as a dependency Update copyright year to 2021 in class headers Update dependencies Update tess4j version to 4.5.4 Update tess4j version to 4.5.3 Configure dependency-check-maven to connect to a central database Add CONTRIBUTING.md with latest information and links Get rid of using "LicenseKeyProductFeature" in ReflectionUtils class in pdfOCR Update japicmp version to 0.14.4 Remove package-info.java [RELEASE] Update dependency versions
2 parents 8d2c19d + c438260 commit d143306

File tree

87 files changed

+501
-175
lines changed

Some content is hidden

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

87 files changed

+501
-175
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/i7j-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/i7j-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

pdfocr-api/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>com.itextpdf</groupId>
77
<artifactId>pdfocr-root</artifactId>
8-
<version>1.0.2</version>
8+
<version>1.0.3</version>
99
</parent>
1010

1111
<artifactId>pdfocr-api</artifactId>

pdfocr-api/src/main/java/com/itextpdf/pdfocr/IImageRotationHandler.java

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.

pdfocr-api/src/main/java/com/itextpdf/pdfocr/IMetaInfoWrapper.java

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.

pdfocr-api/src/main/java/com/itextpdf/pdfocr/IOcrEngine.java

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.

pdfocr-api/src/main/java/com/itextpdf/pdfocr/OcrEngineProperties.java

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.

pdfocr-api/src/main/java/com/itextpdf/pdfocr/OcrException.java

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.

pdfocr-api/src/main/java/com/itextpdf/pdfocr/OcrPdfCreator.java

Lines changed: 23 additions & 29 deletions
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.
@@ -373,36 +373,30 @@ private void addDataToPdfDocument(
373373
final boolean createPdfA3u) throws OcrException {
374374
for (Map.Entry<File, Map<Integer, List<TextInfo>>> entry
375375
: imagesTextData.entrySet()) {
376-
try {
377-
File inputImage = entry.getKey();
378-
List<ImageData> imageDataList =
379-
PdfCreatorUtil.getImageData(inputImage,
380-
ocrPdfCreatorProperties.getImageRotationHandler());
381-
LOGGER.info(MessageFormatUtil.format(
382-
PdfOcrLogMessageConstant.NUMBER_OF_PAGES_IN_IMAGE,
383-
inputImage.toString(), imageDataList.size()));
384-
385-
Map<Integer, List<TextInfo>> imageTextData = entry.getValue();
386-
if (imageTextData.keySet().size() > 0) {
387-
for (int page = 0; page < imageDataList.size(); ++page) {
388-
ImageData imageData = imageDataList.get(page);
389-
final Rectangle imageSize =
390-
PdfCreatorUtil.calculateImageSize(
391-
imageData,
392-
ocrPdfCreatorProperties.getScaleMode(),
393-
ocrPdfCreatorProperties.getPageSize());
394-
395-
if (imageTextData.containsKey(page + 1)) {
396-
addToCanvas(pdfDocument, imageSize,
397-
imageTextData.get(page + 1),
398-
imageData, createPdfA3u);
399-
}
376+
File inputImage = entry.getKey();
377+
List<ImageData> imageDataList =
378+
PdfCreatorUtil.getImageData(inputImage,
379+
ocrPdfCreatorProperties.getImageRotationHandler());
380+
LOGGER.info(MessageFormatUtil.format(
381+
PdfOcrLogMessageConstant.NUMBER_OF_PAGES_IN_IMAGE,
382+
inputImage.toString(), imageDataList.size()));
383+
384+
Map<Integer, List<TextInfo>> imageTextData = entry.getValue();
385+
if (imageTextData.keySet().size() > 0) {
386+
for (int page = 0; page < imageDataList.size(); ++page) {
387+
ImageData imageData = imageDataList.get(page);
388+
final Rectangle imageSize =
389+
PdfCreatorUtil.calculateImageSize(
390+
imageData,
391+
ocrPdfCreatorProperties.getScaleMode(),
392+
ocrPdfCreatorProperties.getPageSize());
393+
394+
if (imageTextData.containsKey(page + 1)) {
395+
addToCanvas(pdfDocument, imageSize,
396+
imageTextData.get(page + 1),
397+
imageData, createPdfA3u);
400398
}
401399
}
402-
} catch (IOException e) {
403-
LOGGER.error(MessageFormatUtil.format(
404-
PdfOcrLogMessageConstant.CANNOT_ADD_DATA_TO_PDF_DOCUMENT,
405-
e.getMessage()));
406400
}
407401
}
408402
}

pdfocr-api/src/main/java/com/itextpdf/pdfocr/OcrPdfCreatorMetaInfo.java

Lines changed: 2 additions & 2 deletions
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.
@@ -80,4 +80,4 @@ public IMetaInfo getWrappedMetaInfo() {
8080
public enum PdfDocumentType {
8181
PDF, PDFA;
8282
}
83-
}
83+
}

pdfocr-api/src/main/java/com/itextpdf/pdfocr/OcrPdfCreatorProperties.java

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)