@@ -964,6 +964,63 @@ (define-public python-pymupdf
analysis, conversion & manipulation of PDF (and other) documents.")
(license license:agpl3+)))
+(define-public pdf-crop-margins
+ (let ((commit "6d89093e33e98ab02196cfc5e06e96003771e735")
+ (revision "0"))
+ (package
+ (name "pdf-crop-margins")
+ (version "2.0.3")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/abarker/pdfCropMargins")
+ ;; Releases are not in git tags.
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "0144px9kl927z6gx380i2sd75izqzxnnzl3laih2dwpqp82r9j6f"))))
+ (build-system pyproject-build-system)
+ (arguments
+ (list
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'lift-requirements
+ (lambda _
+ (substitute* "setup.py"
+ (("pillow>=9\\.3\\.0") ; security issues handled by a patch
+ "pillow>=9.2.0")))))))
+ (native-inputs (list python-setuptools
+ python-pillow))
+ (propagated-inputs (list ghostscript
+ python-pymupdf
+ python-pysimplegui))
+ (home-page "https://github.com/abarker/pdfCropMargins")
+ (synopsis "Automatically crop the margins of PDF files")
+ (description "The pdfCropMargins program is a command-line application to
+automatically crop the margins of PDF files. Cropping the margins can make it
+easier to read the pages of a PDF document -- whether the document is printed
+or displayed on a screen -- because the display fonts are larger.
+
+Features
+@itemize
+@item Automatically detects the margins and can crop a given percentage of them.
+@item Can crop all the pages to the same size to give a uniform appearance.
+@item Renders and analyzes page images to find the bounding boxes, which allows
+it to deal with noisy scanned PDFs.
+@item A rudimentary 'undo' capability is implemented by default.
+@item Can crop pages uniformly based on the nth smallest crop values, to help
+with noisy documents where a few pages have unwanted markings in their margins.
+@item Can automatically run a document previewer on the output file.
+@item The format of automatically-generated output-file names is modifiable.
+@item Preserves document catalog information such as outlines if possible.
+@item Crops rotated pages according to their appearance in the document viewer.
+@item Can deal with at least simple cases of password-encrypted files.
+@item Can automatically apply a Ghostscript repair operation to attempt to fix
+corrupt PDF files.
+@end itemize")
+ (license license:gpl3+))))
+
(define-public qpdf
(package
(name "qpdf")