From 165432486bf5db08370479466fa27d033416f15c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E5=8D=9A=E4=BB=81=28Buo-ren=2C=20Lin=29?= Date: Wed, 3 Aug 2022 07:35:01 +0800 Subject: [PATCH 1/4] snap: add JBIG2 support (#1001) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch includes a jbig2enc build into the snap package, allow the user to run OcrMyPDF with the --jbig2-lossy option or other options that trigger JBIG2 encoding. Signed-off-by: ๆž—ๅšไป(Buo-ren Lin) --- snapcraft.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/snapcraft.yaml b/snapcraft.yaml index 09b1971a..9ac68ae3 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -41,6 +41,13 @@ parts: stage-packages: - lib32stdc++6 + jbig2enc: + plugin: autotools + source: https://github.com/agl/jbig2enc.git + source-tag: '0.29' + build-packages: + - libleptonica-dev + ocrmypdf: plugin: python source: https://github.com/ocrmypdf/OCRmyPDF.git From 4b9ea40a0cce8631bff45fe65be2df0d39945689 Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Thu, 4 Aug 2022 03:21:28 -0700 Subject: [PATCH 2/4] spdx: move identifiers to files that support them If the apparent license changed, take this commit as correct. --- .docker/Dockerfile | 4 ++-- .dockerignore | 3 +++ .gitattributes | 3 +++ .github/FUNDING.yml | 3 +++ .github/ISSUE_TEMPLATE/1-general-issues.md | 2 ++ .../ISSUE_TEMPLATE/2-problem-with-a-specific-input-file.md | 2 ++ .github/ISSUE_TEMPLATE/3-feature_request.md | 2 ++ .github/dependabot.yml | 3 +++ .github/workflows/build.yml | 2 ++ .gitignore | 3 +++ .pre-commit-config.yaml | 3 +++ .readthedocs.yaml | 3 +++ README.md | 3 +++ misc/docker-compose.example.yml | 2 ++ pyproject.toml | 2 ++ snapcraft.yaml | 4 ++++ src/ocrmypdf/RELEASE.md | 3 +++ tests/resources/README.rst | 4 ++++ 18 files changed, 49 insertions(+), 2 deletions(-) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 9e52ca93..3910c343 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -1,5 +1,5 @@ -# OCRmyPDF -# +# SPDX-FileCopyrightText: 2022 James R. Barlow +# SPDX-License-Identifier: MPL-2.0 FROM ubuntu:22.04 as base diff --git a/.dockerignore b/.dockerignore index 2879b33a..173b642f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: 2022 James R. Barlow +# SPDX-License-Identifier: MPL-2.0 + # dotfiles .* !.coveragerc diff --git a/.gitattributes b/.gitattributes index 928cb783..9e64aba4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: 2022 James R. Barlow +# SPDX-License-Identifier: MPL-2.0 + # Always use Unix convention for new lines * text eol=lf diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index f9e58e51..b55abd5a 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: 2022 James R. Barlow +# SPDX-License-Identifier: MPL-2.0 + # These are supported funding model platforms github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] diff --git a/.github/ISSUE_TEMPLATE/1-general-issues.md b/.github/ISSUE_TEMPLATE/1-general-issues.md index 3aa3c2d6..2f876c60 100644 --- a/.github/ISSUE_TEMPLATE/1-general-issues.md +++ b/.github/ISSUE_TEMPLATE/1-general-issues.md @@ -1,3 +1,5 @@ +# SPDX-FileCopyrightText: 2022 James R. Barlow +# SPDX-License-Identifier: CC-BY-SA-4.0 --- name: General issues about: Installation, packages, dependencies, "nothing works", test suite failures... diff --git a/.github/ISSUE_TEMPLATE/2-problem-with-a-specific-input-file.md b/.github/ISSUE_TEMPLATE/2-problem-with-a-specific-input-file.md index d98bf847..32452cc2 100644 --- a/.github/ISSUE_TEMPLATE/2-problem-with-a-specific-input-file.md +++ b/.github/ISSUE_TEMPLATE/2-problem-with-a-specific-input-file.md @@ -1,3 +1,5 @@ +# SPDX-FileCopyrightText: 2022 James R. Barlow +# SPDX-License-Identifier: CC-BY-SA-4.0 --- name: Problem with a specific input file about: Something went wrong while trying to OCR a specific file diff --git a/.github/ISSUE_TEMPLATE/3-feature_request.md b/.github/ISSUE_TEMPLATE/3-feature_request.md index 4f27440d..cb45fe83 100644 --- a/.github/ISSUE_TEMPLATE/3-feature_request.md +++ b/.github/ISSUE_TEMPLATE/3-feature_request.md @@ -1,3 +1,5 @@ +# SPDX-FileCopyrightText: 2022 James R. Barlow +# SPDX-License-Identifier: CC-BY-SA-4.0 --- name: Feature request about: Suggest an idea for this project diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 90e05c40..8dc58889 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: 2022 James R. Barlow +# SPDX-License-Identifier: MPL-2.0 + # To get started with Dependabot version updates, you'll need to specify which # package ecosystems to update and where the package manifests are located. # Please see the documentation for all configuration options: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a895b0fc..dbb96baf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,3 +1,5 @@ +# SPDX-FileCopyrightText: 2022 James R. Barlow +# SPDX-License-Identifier: MPL-2.0 name: Test and deploy on: diff --git a/.gitignore b/.gitignore index 1481bb33..8d4afa31 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: 2022 James R. Barlow +# SPDX-License-Identifier: CC-BY-SA-4.0 + # dotfiles .* !.coveragerc diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8fb0a293..1b99b96c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: 2022 James R. Barlow +# SPDX-License-Identifier: MPL-2.0 + repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.3.0 diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 38fa8dce..68859db8 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: 2022 James R. Barlow +# SPDX-License-Identifier: MPL-2.0 + # Read the Docs configuration file # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details diff --git a/README.md b/README.md index 6d7a0a35..14cb6707 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ + + + OCRmyPDF [![Build Status](https://github.com/ocrmypdf/OCRmyPDF/actions/workflows/build.yml/badge.svg)](https://github.com/ocrmypdf/OCRmyPDF/actions/workflows/build.yml) [![PyPI version][pypi]](https://pypi.org/project/ocrmypdf/) ![Homebrew version][homebrew] ![ReadTheDocs][docs] ![Python versions][pyversions] diff --git a/misc/docker-compose.example.yml b/misc/docker-compose.example.yml index 9668b2b9..c8c77b36 100644 --- a/misc/docker-compose.example.yml +++ b/misc/docker-compose.example.yml @@ -1,3 +1,5 @@ +# SPDX-FileCopyrightText: 2022 James R. Barlow +# SPDX-License-Identifier: MIT --- version: "3.3" services: diff --git a/pyproject.toml b/pyproject.toml index 4d0aba2a..68acb173 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,5 @@ +# SPDX-FileCopyrightText: 2022 James R. Barlow +# SPDX-License-Identifier: MPL-2.0 [build-system] requires = [ "setuptools >= 52", diff --git a/snapcraft.yaml b/snapcraft.yaml index 09b1971a..c0ff4fb2 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2022 Alexander Langanke +# SPDX-FileCopyrightText: 2022 James R. Barlow +# SPDX-License-Identifier: MPL-2.0 + name: ocrmypdf title: OCRmyPDF base: core20 diff --git a/src/ocrmypdf/RELEASE.md b/src/ocrmypdf/RELEASE.md index 2cb89b78..f9eab6db 100644 --- a/src/ocrmypdf/RELEASE.md +++ b/src/ocrmypdf/RELEASE.md @@ -1,3 +1,6 @@ + + + # Release checklist ## Patch release diff --git a/tests/resources/README.rst b/tests/resources/README.rst index 5fb4e9db..efbf8f39 100644 --- a/tests/resources/README.rst +++ b/tests/resources/README.rst @@ -1,3 +1,7 @@ +.. SPDX-FileCopyrightText: 2022 James R. Barlow +.. SPDX-License-Identifier: CC-BY-SA-4.0 + + These test files are used in OCRmyPDF's test suite. They do not necessarily produce OCR results at all and are not meant as examples of OCR output. Some are even invalid PDFs that might crash certain PDF viewers. From 37c050aa4fd3e5797e6085490b00ab2d299b5f0a Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Thu, 4 Aug 2022 03:41:45 -0700 Subject: [PATCH 3/4] readme: fix copyright --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 14cb6707..815d2031 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ - + + OCRmyPDF From d591a3e05962b6b46030e8358f2d11719a29099b Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Thu, 4 Aug 2022 03:42:22 -0700 Subject: [PATCH 4/4] resources readme: remove license and copyright info Better to not repeat ourselves and present this info in example one place. --- tests/resources/README.rst | 135 ++++++++++--------------------------- 1 file changed, 34 insertions(+), 101 deletions(-) diff --git a/tests/resources/README.rst b/tests/resources/README.rst index efbf8f39..91a6b8e1 100644 --- a/tests/resources/README.rst +++ b/tests/resources/README.rst @@ -1,172 +1,105 @@ .. SPDX-FileCopyrightText: 2022 James R. Barlow .. SPDX-License-Identifier: CC-BY-SA-4.0 - These test files are used in OCRmyPDF's test suite. They do not necessarily produce OCR results -at all and are not meant as examples of OCR output. Some are even invalid PDFs that might +at all and are not necessarily meant as examples of OCR output. Some are even invalid PDFs that might crash certain PDF viewers. - -Files derived from free sources -=============================== - -These test resources come from free sources, under either public domain or Creative Commons licenses. -In some cases they were converted from one image format to another without other changes. +Some of these images were obtained from the public domain. Others are copyrighted and may have +licenses associated. Refer to ``.reuse/dep5`` file in OCRmyPDF's Git repository for information on +the copyright holder(s) and license(s) applicable to these resources. .. list-table:: - :widths: 20 50 30 + :widths: 15 35 50 :header-rows: 1 * - File - Source - - License + - Purpose * - c02-22.pdf - `Project Gutenberg`_, Adventures of Huckleberry Finn, page 22 - - Public Domain + - difficult OCR image (obscure fonts and illustrations) * - congress.jpg - `US Congressional Records`_ - - Public Domain + - difficult OCR image (color background) * - graph.pdf - `Wikimedia: Pandas text analysis.png`_ - - Public Domain + - image with slanted text * - lichtenstein.pdf - `Wikimedia: JPEG2000 Lichtenstein`_ - - Creative Commons BY-SA 3.0 + - JPEG2000 image * - linn.png, linn.pdf, linn.txt - `Wikimedia: LinnSequencer`_ - - Creative Commons BY-SA 3.0 + - image with two columns * - typewriter.png, 2400dpi.pdf - `Wikimedia: Triumph typewrtier text Linzensoep`_ - - Creative Commons BY-SA 2.5 + - simple text * - baiona.png - `Wikimedia: Baionako udalerri mugakideak`_ - - Creative Commons BY-SA 4.0 - * - enron1.pdf - - EnronData.org - - Creative Commons BY 3.0 - - -Files generated for this project -================================ - -The following test resources were crafted specifically for this project, and are -licensed under the specified license. - -.. list-table:: - :widths: 20 40 15 15 10 - :header-rows: 1 - - * - File - - Purpose - - Contributor - - Copyright Holder - - License + - multilingual text and images * - aspect.pdf + - synthetic - test image with 200 x 100 DPI resolution - - @jbarlow83 - - @jbarlow83 - - CC-BY-SA 4.0 * - blank.pdf + - synthetic - blank PDF generated by Adobe Illustrator CC 17, containing a lot of application-specific metadata/bloat - - @jbarlow83 - - @jbarlow83 - - CC-BY-SA 4.0 * - cmyk.pdf + - synthetic - a CMYK image created in Photoshop - - @jbarlow83 - - @jbarlow83 - - CC-BY-SA 4.0 * - crom.png + - synthetic - test for non-dictionary words - - @jbarlow83 - - @jbarlow83 - - CC-BY-SA 4.0 * - enormous.pdf + - synthetic - very large PDF page - - @jbarlow83 - - @jbarlow83 - - CC-BY-SA 4.0 * - epson.pdf + - synthetic - a linearized PDF containing some unusual indirect objects, created by an Epson printer; printout of a Wikipedia article (CC-BY-SA) - - @lowesjam - - Wikipedia authors - - CC-BY-SA 3.0 * - formxobject.pdf + - synthetic - hand-crafted PDF containing an image inside a Form XObject - - @jbarlow83 - - @jbarlow83 - - CC-BY-SA 4.0 * - francais.pdf + - synthetic - a page containing French accents (diacritics) - - @jbarlow83 - - @jbarlow83 - - CC-BY-SA 4.0 * - hugemono.pdf + - synthetic - large monochrome 35000x35000 image in JBIG2 encoding - - @jbarlow83 - - @jbarlow83 - - CC-BY-SA 4.0 * - invalid.pdf + - synthetic - a PDF file header followed by EOF marker - - @jbarlow83 - - @jbarlow83 - - CC-BY-SA 4.0 * - kcs.pdf + - synthetic - PDF file generated by Kodak Capture Desktop Software 1.2; has invalid table of contents - - @jbarlow83 - - @jbarlow83 - - CC-BY-SA 4.0 * - livecycle.pdf + - synthetic - a minimal PDF that claims to use dynamic XFA forms - - @jbarlow83 - - @jbarlow83 - - CC-BY-SA 4.0 * - masks.pdf + - synthetic - file containing explicit masks and a stencil mask drawn without a proper transformation matrix; printout of a German Wikipedia article (CC-BY-SA) - - @supergrobi - - Wikipedia authors - - CC-BY-SA 3.0 * - missing_docinfo.pdf + - synthetic - PDF file with no /DocumentInfo section - - @jbarlow83 - - @jbarlow83 - - CC-BY-SA 4.0 * - overlay.pdf + - synthetic - PDF file generated by PDFPen pro that triggered content stream parse errors - - @maxandersen - - @maxandersen - - CC-BY-SA 4.0 * - negzero.pdf + - synthetic - copy of formxobject.pdf with token that qpdf doesn't like - - @jbarlow83 - - @jbarlow83 - - CC-BY-SA 4.0 * - no_contents.pdf + - synthetic - synthetic PDF with a blank page that has no /Contents entry - - @jbarlow83 - - @jbarlow83 - - CC-BY-SA 4.0 * - truetype_font_nomapping.pdf + - synthetic - example of a PDF with an embedded subsetted TrueType font with no Unicode mapping - - @jbarlow83 - - @jbarlow83 - - CC-BY-SA 4.0 * - trivial.pdf + - synthetic - smallest possible valid PDF-1.3 with all required fields - - @jbarlow83 - - @jbarlow83 - - CC-BY-SA 4.0 * - type3_font_nomapping.pdf + - synthetic - example of a PDF with an embedded subsetted TrueType font with no Unicode mapping - - @jbarlow83 - - @jbarlow83 - - CC-BY-SA 4.0 * - vector.pdf + - synthetic - a PDF with vector art and text rendered as curves with no fonts - - @Catscratch - - @Catscratch - - CC-BY-SA 4.0 - Assemblies ==========