projects/guix·blob python-team · refs

2257 lines · 86.4 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013, 2015, 2016 Andreas Enge <[email protected]>
3;;; Copyright © 2014 Mark H Weaver <[email protected]>
4;;; Copyright © 2014, 2015, 2016, 2018, 2019, 2021, 2024, 2025 Ricardo Wurmus <[email protected]>
5;;; Copyright © 2015 Paul van der Walt <[email protected]>
6;;; Copyright © 2016 Roel Janssen <[email protected]>
7;;; Copyright © 2016 Nikita <[email protected]>
8;;; Copyright © 2016-2020, 2022, 2023 Efraim Flashner <[email protected]>
9;;; Copyright © 2016, 2017, 2022 Marius Bakke <[email protected]>
10;;; Copyright © 2016, 2017, 2019 Ludovic Courtès <[email protected]>
11;;; Copyright © 2016 Julien Lepiller <[email protected]>
12;;; Copyright © 2016, 2019 Arun Isaac <[email protected]>
13;;; Copyright © 2017, 2018 Leo Famulari <[email protected]>
14;;; Copyright © 2017 Alex Vong <[email protected]>
15;;; Copyright © 2017, 2018 Rene Saavedra <[email protected]>
16;;; Copyright © 2017–2022 Tobias Geerinckx-Rice <[email protected]>
17;;; Copyright © 2019 Alex Griffin <[email protected]>
18;;; Copyright © 2019 Ben Sturmfels <[email protected]>
19;;; Copyright © 2019,2020 Hartmut Goebel <[email protected]>
20;;; Copyright © 2020-2026 Nicolas Goaziou <[email protected]>
21;;; Copyright © 2020, 2022 Michael Rohleder <[email protected]>
22;;; Copyright © 2020, 2024 Timotej Lazar <[email protected]>
23;;; Copyright © 2020, 2022, 2023, 2024, 2025 Maxim Cournoyer <[email protected]>
24;;; Copyright © 2021 Maxime Devos <[email protected]>
25;;; Copyright © 2022 Paul A. Patience <[email protected]>
26;;; Copyright © 2022 Petr Hodina <[email protected]>
27;;; Copyright © 2023 Felix Gruber <[email protected]>
28;;; Copyright © 2024 dan <[email protected]>
29;;; Copyright © 2023 Benjamin Slade <[email protected]>
30;;; Copyright © 2024 Artyom V. Poptsov <[email protected]>
31;;; Copyright © 2024 Aaron Covrig <[email protected]>
32;;; Copyright © 2025 Jussi Timperi <[email protected]>
33;;; Copyright © 2024 Janneke Nieuwenhuizen <[email protected]>
34;;; Copyright © 2026 Daniel Littlewood <[email protected]>
35;;; Copyright © 2026 Sughosha <[email protected]>
36;;; Copyright © 2026 Herman Rimm <[email protected]>
37;;;
38;;; This file is part of GNU Guix.
39;;;
40;;; GNU Guix is free software; you can redistribute it and/or modify it
41;;; under the terms of the GNU General Public License as published by
42;;; the Free Software Foundation; either version 3 of the License, or (at
43;;; your option) any later version.
44;;;
45;;; GNU Guix is distributed in the hope that it will be useful, but
46;;; WITHOUT ANY WARRANTY; without even the implied warranty of
47;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
48;;; GNU General Public License for more details.
49;;;
50;;; You should have received a copy of the GNU General Public License
51;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
52
53(define-module (gnu packages pdf)
54 #:use-module ((guix licenses) #:prefix license:)
55 #:use-module (guix packages)
56 #:use-module (guix download)
57 #:use-module (guix gexp)
58 #:use-module (guix git-download)
59 #:use-module (guix utils)
60 #:use-module (guix build-system ant)
61 #:use-module (guix build-system gnu)
62 #:use-module (guix build-system cmake)
63 #:use-module (guix build-system meson)
64 #:use-module (guix build-system ocaml)
65 #:use-module (guix build-system pyproject)
66 #:use-module (guix build-system qt)
67 #:use-module (gnu packages)
68 #:use-module (gnu packages aidc)
69 #:use-module (gnu packages audio)
70 #:use-module (gnu packages autotools)
71 #:use-module (gnu packages backup)
72 #:use-module (gnu packages base)
73 #:use-module (gnu packages bash)
74 #:use-module (gnu packages build-tools)
75 #:use-module (gnu packages check)
76 #:use-module (gnu packages compression)
77 #:use-module (gnu packages cups)
78 #:use-module (gnu packages curl)
79 #:use-module (gnu packages djvu)
80 #:use-module (gnu packages documentation)
81 #:use-module (gnu packages fonts)
82 #:use-module (gnu packages fontutils)
83 #:use-module (gnu packages game-development)
84 #:use-module (gnu packages gcc)
85 #:use-module (gnu packages gettext)
86 #:use-module (gnu packages ghostscript)
87 #:use-module (gnu packages gl)
88 #:use-module (gnu packages glib)
89 #:use-module (gnu packages gnome)
90 #:use-module (gnu packages gnupg)
91 #:use-module (gnu packages gstreamer)
92 #:use-module (gnu packages gtk)
93 #:use-module (gnu packages image)
94 #:use-module (gnu packages java)
95 #:use-module (gnu packages javascript)
96 #:use-module (gnu packages kde-frameworks)
97 #:use-module (gnu packages toolkits)
98 #:use-module (gnu packages libffi)
99 #:use-module (gnu packages llvm)
100 #:use-module (gnu packages linux)
101 #:use-module (gnu packages lua)
102 #:use-module (gnu packages man)
103 #:use-module (gnu packages markup)
104 #:use-module (gnu packages nss)
105 #:use-module (gnu packages ocaml)
106 #:use-module (gnu packages ocr)
107 #:use-module (gnu packages package-management)
108 #:use-module (gnu packages pcre)
109 #:use-module (gnu packages perl)
110 #:use-module (gnu packages photo)
111 #:use-module (gnu packages pkg-config)
112 #:use-module (gnu packages pretty-print)
113 #:use-module (gnu packages pulseaudio)
114 #:use-module (gnu packages python)
115 #:use-module (gnu packages python-build)
116 #:use-module (gnu packages python-check)
117 #:use-module (gnu packages python-web)
118 #:use-module (gnu packages python-xyz)
119 #:use-module (gnu packages qt)
120 #:use-module (gnu packages sdl)
121 #:use-module (gnu packages sphinx)
122 #:use-module (gnu packages sqlite)
123 #:use-module (gnu packages swig)
124 #:use-module (gnu packages tex)
125 #:use-module (gnu packages time)
126 #:use-module (gnu packages tcl)
127 #:use-module (gnu packages tls)
128 #:use-module (gnu packages video)
129 #:use-module (gnu packages web)
130 #:use-module (gnu packages webkit)
131 #:use-module (gnu packages xdisorg)
132 #:use-module (gnu packages xml)
133 #:use-module (gnu packages xorg)
134 #:use-module (srfi srfi-1))
135
136(define-public capypdf
137 (package
138 (name "capypdf")
139 (version "0.18.0")
140 (source (origin
141 (method git-fetch)
142 (uri (git-reference
143 (url "https://github.com/jpakkane/capypdf")
144 (commit version)))
145 (file-name (git-file-name name version))
146 (sha256
147 (base32 "1929hswywf70lb97wp3xmri45h55n1dyq97n50frj8js582z0aqn"))))
148 (build-system meson-build-system)
149 (arguments
150 (list #:configure-flags #~(list "-Dcpp_std=c++23")
151 #:test-options '(list "plainc")))
152 (inputs (list freetype
153 gtk
154 lcms
155 libjpeg-turbo
156 libpng
157 zlib))
158 (native-inputs (list font-google-noto
159 ghostscript
160 pkg-config
161 python
162 python-pillow))
163 (home-page "https://github.com/jpakkane/a4pdf")
164 (synopsis "Color-managed PDF generator")
165 (description "A4PDF is a low-level library for generating PDF files.
166It does not have a document model and instead uses PDF primitives
167directly. It uses LittleCMS for color management but otherwise does not
168convert data in any way.")
169 (license license:asl2.0)))
170
171(define-public cpdf
172 (package
173 (name "cpdf")
174 (version "2.9")
175 (source
176 (origin
177 (method git-fetch)
178 (uri (git-reference
179 (url "https://github.com/johnwhitington/cpdf-source")
180 (commit (string-append "v" version))))
181 (file-name (git-file-name name version))
182 (sha256
183 (base32 "0gp5c82jmypa0ssdm3bdf3shaf9m0vncjs61bcqnchrxaclcd9vg"))))
184 (build-system ocaml-build-system)
185 (arguments
186 (list
187 #:tests? #f ;no tests
188 #:phases
189 #~(modify-phases %standard-phases
190 (delete 'configure)
191 (add-after 'unpack 'patch-makefile-shell
192 (lambda _
193 (patch-makefile-SHELL "OCamlMakefile")))
194 (add-after 'install 'install-bin
195 (lambda _
196 (let ((bin (string-append #$output "/bin")))
197 (install-file "cpdf" bin))))
198 (add-after 'install-bin 'install-doc
199 (lambda _
200 (let ((doc (string-append #$output "/share/doc/"
201 #$name "-" #$version))
202 (man1 (string-append #$output "/share/man/man1")))
203 (install-file "cpdf.1" man1)
204 (install-file "cpdfmanual.pdf" doc)
205 (copy-recursively "doc/cpdf/html"
206 (string-append doc "/html"))))))))
207 (propagated-inputs (list ocaml-camlpdf))
208 (home-page "https://www.coherentpdf.com")
209 (synopsis "Command-line tool for PDF manipulation")
210 (description
211 "The cpdf package provides a command-line tool and an OCaml library
212designed for manipulating PDF documents. Key Features include:
213
214@itemize @bullet
215@item
216Splitting and merging PDF files (including bookmark preservation and
217splitting on bookmarks).
218@item
219Encryption and decryption (supports AES 128 and AES 256).
220@item
221Page manipulation: scaling, rotation, cropping, and flipping; fitting
222pages to a specific size.
223@item
224Bookmark management: copying, removing, and adding bookmarks.
225@item
226Watermarking: stamping logos, page numbers, and multi-line text with
227transparency support.
228@item
229Text and font handling: embedding TrueType fonts, supporting Unicode
230UTF-8 input and output, and converting text to PDF.
231@item
232Presentation features: creating PDF-based presentations and arranging
233multiple pages on a single page.
234@item
235Annotation management: listing, copying, setting, and removing
236annotations.
237@item
238Metadata management: reading and setting document information and
239metadata.
240@item
241Attachment handling: adding and removing file attachments to documents
242or pages.
243@item
244Advanced features: thickening hairlines, blackening text,
245reconstructing malformed files, detecting missing fonts and
246low-resolution images, exporting/importing in JSON format, and
247building table of contents.
248@item
249Drawing: Adding graphics and text directly onto PDF files.
250@end itemize")
251 (license license:agpl3+)))
252
253(define-public diffpdf
254 (let ((commit "ba68231d3d05e0cb3a2d4a4fca8b70d4044f4303")
255 (revision "1"))
256 (package
257 (name "diffpdf")
258 (version (git-version "2.1.3.1" revision commit))
259 (source (origin
260 (method git-fetch)
261 (uri (git-reference
262 (url "https://gitlab.com/eang/diffpdf")
263 (commit commit)))
264 (file-name (git-file-name name version))
265 (sha256
266 (base32
267 "1vwgv28b291lrcs9fljnlbnicv16lwj4vvl4bz6w3ldp9n5isjmf"))))
268 (build-system qt-build-system)
269 (arguments
270 `(#:tests? #f))
271 (inputs (list qtbase-5 qttools-5 qtwayland-5 poppler-qt5))
272 (native-inputs (list pkg-config extra-cmake-modules))
273 (home-page "http://www.qtrac.eu/diffpdf-foss.html")
274 (synopsis "Compare two PDF files")
275 (description
276 "@command{diffpdf} lets you compare PDF files, offering three
277comparison modes: words, characters, and appearance.")
278 (license license:gpl2))))
279
280(define-public extractpdfmark
281 (package
282 (name "extractpdfmark")
283 (version "1.1.1")
284 (source
285 (origin
286 (method git-fetch)
287 (uri (git-reference
288 (url "https://github.com/trueroad/extractpdfmark")
289 (commit (string-append "v" version))))
290 (file-name (git-file-name name version))
291 (sha256
292 (base32 "0yzc3ajgdfb4ssxp49g2vrki45kl144j39bg0wdn6h9dc14kzmx4"))))
293 (build-system gnu-build-system)
294 (arguments
295 (list #:phases
296 #~(modify-phases %standard-phases
297 (add-before 'check 'set-home
298 ;; The test suite wants to write to /homeless-shelter
299 (lambda _ (setenv "HOME" (getcwd)))))))
300 (native-inputs
301 (list autoconf
302 automake
303 gettext-minimal
304 ghostscript
305 pkg-config
306 (texlive-local-tree)))
307 (inputs
308 (list poppler))
309 (home-page "https://github.com/trueroad/extractpdfmark")
310 (synopsis "Extract page mode and named destinations as PDFmark from PDF")
311 (description
312 "PDFmarks is a technique that accompanies PDF, and that is used to store
313metadata such as author or title, but also structural information such as
314bookmarks or hyperlinks.
315
316When Ghostscript reads the main PDF generated by the TeX system with embedded
317PDF files and outputs the final PDF, the PDF page mode and name targets
318etc. are not preserved. Therefore, when you open the final PDF, it is not
319displayed correctly. Also, remote PDF links do not work correctly.
320
321This program is able to extract the page mode and named targets as PDFmark
322from PDF. In this way, you can obtain embedded PDF files that have kept this
323information.")
324 (license license:gpl3)))
325
326(define-public flyer-composer
327 (package
328 (name "flyer-composer")
329 (version "1.0")
330 (source
331 (origin
332 (method url-fetch)
333 (uri (pypi-uri "flyer_composer" version))
334 (sha256
335 (base32 "1874vmz606155w9xm3r4q9xziva1mai1kyqhjg5hnndpwl09xgv5"))))
336 (build-system pyproject-build-system)
337 (arguments
338 `(#:tests? #f ;; TODO
339 #:phases
340 (modify-phases %standard-phases
341 (add-after 'wrap 'wrap-gui
342 (lambda* (#:key inputs outputs #:allow-other-keys)
343 (let* ((out (assoc-ref outputs "out"))
344 (qtbase (assoc-ref inputs "qtbase"))
345 (qtwayland (assoc-ref inputs "qtwayland"))
346 (qml "/lib/qt5/qml"))
347 (wrap-program (string-append out "/bin/flyer-composer-gui")
348 `("QT_PLUGIN_PATH" ":" =
349 (,(string-append qtbase "/lib/qt5/plugins")
350 ,(string-append qtwayland "/lib/qt5/plugins")))
351 `("QT_QPA_PLATFORM_PLUGIN_PATH" ":" =
352 (,(string-append qtbase "/lib/qt5/plugins/platforms"))))))))))
353 (native-inputs (list python-setuptools python-wheel))
354 (propagated-inputs (list python-pypdf))
355 (inputs (list bash-minimal python-poppler-qt5 python-pyqt qtbase-5 qtwayland-5))
356 (home-page "http://crazy-compilers.com/flyer-composer")
357 (synopsis "Rearrange PDF pages to print as flyers on one sheet")
358 (description "@command{flyer-composer} can be used to prepare one- or
359two-sided flyers for printing on one sheet of paper.
360
361Imagine you have designed a flyer in A6 format and want to print it using your
362A4 printer. Of course, you want to print four flyers on each sheet. This is
363where Flyer Composer steps in, creating a PDF which holds your flyer four
364times. If you have a second page, Flyer Composer can arrange it the same way
365- even if the second page is in a separate PDF file.
366
367This package contains both the command line tool and the gui too.")
368 (license license:agpl3+)))
369
370(define-public flyer-composer-cli
371 (package/inherit flyer-composer
372 (name "flyer-composer-cli")
373 (arguments
374 `(#:tests? #f ;; TODO
375 #:phases
376 (modify-phases %standard-phases
377 (add-after 'unpack 'remove-gui
378 (lambda _
379 (delete-file-recursively "flyer_composer/gui")
380 (substitute* "setup.cfg"
381 (("^\\s+flyer-composer-gui\\s*=.*") ""))
382 #t)))))
383 (inputs (list)) ; clear the gui inputs
384 (description "@command{flyer-composer} can be used to prepare one- or
385two-sided flyers for printing on one sheet of paper.
386
387Imagine you have designed a flyer in A6 format and want to print it using your
388A4 printer. Of course, you want to print four flyers on each sheet. This is
389where Flyer Composer steps in, creating a PDF which holds your flyer four
390times. If you have a second page, Flyer Composer can arrange it the same way
391- even if the second page is in a separate PDF file.
392
393This package contains only the command line tool. If you like to use the gui,
394please install the @code{flyer-composer-gui} package.")))
395
396(define-public poppler
397 (package
398 (name "poppler")
399 (version "26.07.0")
400 (source (origin
401 (method url-fetch)
402 (uri (string-append "https://poppler.freedesktop.org/poppler-"
403 version ".tar.xz"))
404 (sha256
405 (base32
406 "1qh1rbs9vjpl8prjc1ws1k0kg3z6hkvd3dn6j35gsiwaizs34j1h"))))
407 (build-system cmake-build-system)
408 (inputs (list curl
409 fontconfig
410 freetype
411 libjpeg-turbo
412 libpng
413 libtiff
414 lcms
415 nss ;for 'pdfsig'
416 openjpeg
417 poppler-data
418 zlib
419 ;; To build poppler-glib (as needed by Evince), we need Cairo and
420 ;; GLib. But of course, that Cairo must not depend on Poppler.
421 cairo-sans-poppler))
422 (propagated-inputs
423 ;; As per poppler-cairo and poppler-glib.pc.
424 ;; XXX: Ideally we'd propagate Cairo too, but that would require a
425 ;; different solution to the circular dependency mentioned above.
426 (list glib))
427 (native-inputs
428 (append
429 (list pkg-config
430 `(,glib "bin") ; glib-mkenums, etc.
431 gobject-introspection
432 python)
433 (if (%current-target-system)
434 (list pkg-config-for-build)
435 '())))
436 (arguments
437 (list
438 ;; The Poppler test suite needs to be downloaded separately and contains
439 ;; non-free (and non-auditable) files, so we skip them. See
440 ;; <https://lists.gnu.org/archive/html/guix-devel/2022-06/msg00394.html>.
441 #:tests? #f
442 #:configure-flags
443 #~(list "-DENABLE_UNSTABLE_API_ABI_HEADERS=ON" ;to install header files
444 "-DENABLE_BOOST=OFF" ;disable Boost to save size
445 (string-append "-DCMAKE_INSTALL_LIBDIR=" #$output "/lib")
446 (string-append "-DCMAKE_INSTALL_RPATH=" #$output "/lib")
447 "-DENABLE_GPGME=OFF"
448 "-DENABLE_QT5=OFF"
449 "-DENABLE_QT6=OFF")
450 #:phases
451 #~(modify-phases %standard-phases
452 (add-after 'unpack 'set-PKG_CONFIG
453 (lambda _
454 (when (not #$(%current-target-system))
455 (setenv "PKG_CONFIG" #$(pkg-config-for-target)))))
456 (add-after 'install 'sanitize-pkg-config-files
457 (lambda _
458 (substitute* (find-files #$output "\\.pc$")
459 (("^Requires.private:.*" all)
460 (string-append "# " all))))))))
461 (synopsis "PDF rendering library")
462 (description
463 "Poppler is a PDF rendering library based on the xpdf-3.0 code base.
464Poppler gives access to the following binary programs:
465@itemize
466@item pdfattach
467@item pdfdetach
468@item pdffonts
469@item pdfimages
470@item pdfinfo
471@item pdfseparate
472@item pdfsig
473@item pdftocairo
474@item pdftohtml
475@item pdftoppm
476@item pdftops
477@item pdftotext
478@item pdfunite
479@end itemize")
480 (license license:gpl2+)
481 (home-page "https://poppler.freedesktop.org/")))
482
483(define-deprecated-package poppler-next poppler)
484
485(define-public poppler-data
486 (package
487 (name "poppler-data")
488 (version "0.4.12")
489 (source (origin
490 (method url-fetch)
491 (uri (string-append "https://poppler.freedesktop.org/poppler-data"
492 "-" version ".tar.gz"))
493 (sha256
494 (base32
495 "0x5brm8vibb3zzdbhjfxvm6s5zzdjnyslrinp3hmgqqcli0bcdf8"))))
496 (build-system gnu-build-system)
497 (arguments
498 '(#:tests? #f ; no test suite
499 #:make-flags (list (string-append "prefix=" (assoc-ref %outputs "out")))
500 #:phases
501 (modify-phases %standard-phases
502 ;; The package only provides some data files, so there is nothing to
503 ;; build.
504 (delete 'configure)
505 (delete 'build))))
506 (synopsis "Poppler encoding files for rendering of CJK and Cyrillic text")
507 (description "This package provides optional encoding files for Poppler.
508When present, Poppler is able to correctly render CJK and Cyrillic text.")
509 (home-page (package-home-page poppler))
510 ;; See COPYING in the source distribution for more information about
511 ;; the licensing.
512 (license (list license:bsd-3
513 license:gpl2
514 license:expat)))) ;Makefile
515
516(define-public poppler-qt5
517 (package/inherit poppler
518 (name "poppler-qt5")
519 (arguments
520 (substitute-keyword-arguments arguments
521 ((#:configure-flags flags)
522 #~(delete "-DENABLE_QT5=OFF" #$flags))))
523 (inputs `(("qtbase" ,qtbase-5)
524 ,@(package-inputs poppler)))
525 (synopsis "Qt5 frontend for the Poppler PDF rendering library")))
526
527(define-public poppler-qt6
528 (package/inherit poppler
529 (name "poppler-qt6")
530 (arguments
531 (substitute-keyword-arguments arguments
532 ((#:configure-flags flags)
533 #~(delete "-DENABLE_QT6=OFF" #$flags))))
534 (inputs (modify-inputs inputs
535 (append qtbase)))
536 (synopsis "Qt6 frontend for the Poppler PDF rendering library")))
537
538(define-public python-poppler-qt5
539 (package
540 (name "python-poppler-qt5")
541 (version "21.3.0")
542 (source
543 (origin
544 (method git-fetch)
545 (uri (git-reference
546 (url "https://github.com/frescobaldi/python-poppler-qt5")
547 (commit (string-append "v" version))))
548 (file-name (git-file-name name version))
549 (sha256
550 (base32 "0rxjljxsiwvgbn576f0fc9jbj750yc474rzh9kyp371p7rvijxhv"))))
551 (build-system pyproject-build-system)
552 (arguments
553 (list #:tests? #f)) ;No tests upstream.
554 (native-inputs (list pkg-config))
555 (inputs (list python-sip python-pyqt-builder python-pyqt poppler-qt5
556 qtbase-5))
557 (home-page "https://github.com/frescobaldi/python-poppler-qt5")
558 (synopsis "Python binding to Poppler-Qt5")
559 (description
560 "This package provides Python bindings for the Qt5 interface of the
561Poppler PDF rendering library.")
562 (license license:lgpl2.1+)))
563
564(define-public libharu
565 (package
566 (name "libharu")
567 (version "2.4.3")
568 (source
569 (origin
570 (method git-fetch)
571 (uri (git-reference
572 (url "https://github.com/libharu/libharu")
573 (commit (string-append "v" version))))
574 (file-name (git-file-name name version))
575 (sha256
576 (base32 "00b89zqf0bxslx03ginzqdjg84zfmblq13p5f4xm0h05j7aq7ixz"))))
577 (build-system cmake-build-system)
578 (arguments
579 (list #:tests? #f ; No tests
580 #:phases
581 #~(modify-phases %standard-phases
582 (add-after 'unpack 'patch-cmake
583 (lambda _
584 (substitute* "CMakeLists.txt"
585 (("^install\\(FILES (README\\.md CHANGES) INSTALL DESTINATION .*\\)"
586 _ files)
587 (format #f "install(FILES ~a DESTINATION ~a/share/doc/~a-~a)"
588 files #$output #$name #$version))))))))
589 (inputs
590 (list libpng zlib))
591 (home-page "http://libharu.org/")
592 (synopsis "Library for generating PDF files")
593 (description
594 "libHaru is a library for generating PDF files. libHaru does not support
595reading and editing of existing PDF files.")
596 (license license:zlib)))
597
598(define-public xpdf
599 (package
600 (name "xpdf")
601 (version "4.06")
602 (source
603 (origin
604 (method url-fetch)
605 (uri (string-append "https://dl.xpdfreader.com/xpdf-" version ".tar.gz"))
606 (sha256
607 (base32 "0zhk9n4mk62mfbl086g1kknk2smrhnl44v9q2bvy1bkcqhkzaf0w"))))
608 (build-system cmake-build-system)
609 (inputs (list cups freetype libpng qtbase-5 zlib))
610 (arguments
611 `(#:tests? #f)) ; there is no check target
612 (synopsis "Viewer for PDF files based on the Motif toolkit")
613 (description
614 "Xpdf is a viewer for Portable Document Format (PDF) files.")
615 (license license:gpl3) ; or gpl2, but not gpl2+
616 (home-page "https://www.xpdfreader.com/")))
617
618(define-public zathura-cb
619 (package
620 (name "zathura-cb")
621 (version "2026.02.03")
622 (source (origin
623 (method git-fetch)
624 (uri (git-reference
625 (url "https://github.com/pwmt/zathura-cb")
626 (commit version)))
627 (file-name (git-file-name name version))
628 (sha256
629 (base32
630 "17w0iv7a503q95qdqx7qpjkxdqfyzw0qld4d8a98hkhg3ljrp5ck"))))
631 (native-inputs (list pkg-config))
632 (inputs (list libarchive zathura))
633 (build-system meson-build-system)
634 (arguments
635 (list
636 #:tests? #f ; package does not contain tests
637 #:configure-flags
638 #~(list (string-append "-Dplugindir=" #$output "/lib/zathura"))))
639 (home-page "https://pwmt.org/projects/zathura-cb/")
640 (synopsis "Comic book support for zathura (libarchive backend)")
641 (description "The zathura-cb plugin adds comic book support to zathura
642using libarchive.")
643 (license license:zlib)))
644
645(define-public zathura-ps
646 (package
647 (name "zathura-ps")
648 (version "2026.02.03")
649 (source (origin
650 (method git-fetch)
651 (uri (git-reference
652 (url "https://github.com/pwmt/zathura-ps")
653 (commit version)))
654 (file-name (git-file-name name version))
655 (sha256
656 (base32
657 "14p188qmd9kkdfi8im8ispdzzafslqa0h6aafcgxl0fwv2ywnbg6"))))
658 (native-inputs (list pkg-config))
659 (inputs (list libspectre zathura))
660 (build-system meson-build-system)
661 (arguments
662 (list
663 #:tests? #f ;package does not contain tests
664 #:configure-flags
665 #~(list (string-append "-Dplugindir=" #$output "/lib/zathura"))))
666 (home-page "https://pwmt.org/projects/zathura-ps/")
667 (synopsis "PS support for zathura (libspectre backend)")
668 (description "The zathura-ps plugin adds PS support to zathura
669using libspectre.")
670 (license license:zlib)))
671
672(define-public zathura-djvu
673 (package
674 (name "zathura-djvu")
675 (version "2026.02.03")
676 (source (origin
677 (method git-fetch)
678 (uri (git-reference
679 (url "https://github.com/pwmt/zathura-djvu")
680 (commit version)))
681 (file-name (git-file-name name version))
682 (sha256
683 (base32
684 "0742bd7f8nansshnfa2qvq344kz8wvnwa3l3cz6jyfdfmn27vng4"))))
685 (native-inputs (list pkg-config))
686 (inputs
687 (list djvulibre zathura))
688 (build-system meson-build-system)
689 (arguments
690 (list #:tests? #f ;package does not contain tests
691 #:configure-flags
692 #~(list (string-append "-Dplugindir=" #$output "/lib/zathura"))))
693 (home-page "https://pwmt.org/projects/zathura-djvu/")
694 (synopsis "DjVu support for zathura (DjVuLibre backend)")
695 (description "The zathura-djvu plugin adds DjVu support to zathura
696using the DjVuLibre library.")
697 (license license:zlib)))
698
699(define-public zathura-pdf-mupdf
700 (package
701 (name "zathura-pdf-mupdf")
702 (version "2026.02.03")
703 (source (origin
704 (method git-fetch)
705 (uri (git-reference
706 (url "https://github.com/pwmt/zathura-pdf-mupdf")
707 (commit version)))
708 (file-name (git-file-name name version))
709 (sha256
710 (base32
711 "1s4dnr5yl4bpqccp79y7i2dgd4qj7x4zrwms4l1id61il70rmmm4"))))
712 (native-inputs (list pkg-config))
713 (inputs
714 (list mupdf zathura))
715 (build-system meson-build-system)
716 (arguments
717 (list
718 #:tests? #f ;package does not contain tests
719 #:configure-flags
720 #~(list (string-append "-Dplugindir=" #$output "/lib/zathura"))
721 #:phases
722 #~(modify-phases %standard-phases
723 (add-after 'unpack 'remove-libmupdfthird.a-requirement
724 (lambda _
725 ;; Ignore a missing (apparently superfluous) static library.
726 (substitute* "meson.build"
727 (("mupdfthird = .*")
728 "")
729 ((", mupdfthird")
730 "")))))))
731 (home-page "https://pwmt.org/projects/zathura-pdf-mupdf/")
732 (synopsis "PDF support for zathura (mupdf backend)")
733 (description "The zathura-pdf-mupdf plugin adds PDF support to zathura
734by using the @code{mupdf} rendering library.")
735 (license license:zlib)))
736
737(define-public zathura-pdf-poppler
738 (package
739 (name "zathura-pdf-poppler")
740 (version "2026.02.03")
741 (source (origin
742 (method git-fetch)
743 (uri (git-reference
744 (url "https://github.com/pwmt/zathura-pdf-poppler")
745 (commit version)))
746 (file-name (git-file-name name version))
747 (sha256
748 (base32
749 "11ivqwwpj0rj4ar6b1p413j8zpcril1j0057lr0iz8a1x94vdmbm"))))
750 (native-inputs (list pkg-config))
751 (inputs
752 (list poppler zathura))
753 (build-system meson-build-system)
754 (arguments
755 (list #:tests? #f ; package does not include tests
756 #:configure-flags
757 #~(list (string-append "-Dplugindir=" #$output "/lib/zathura"))))
758 (home-page "https://pwmt.org/projects/zathura-pdf-poppler/")
759 (synopsis "PDF support for zathura (poppler backend)")
760 (description "The zathura-pdf-poppler plugin adds PDF support to zathura
761by using the poppler rendering engine.")
762 (license license:zlib)))
763
764(define-public zathura
765 (package
766 (name "zathura")
767 (version "2026.03.27")
768 (source (origin
769 (method git-fetch)
770 (uri (git-reference
771 (url "https://github.com/pwmt/zathura.git/")
772 (commit version)))
773 (file-name (git-file-name name version))
774 (sha256
775 (base32
776 "1l5p0w84in8hlw07406ahkcg9x6ci56vp02i4fc3skp38svz0wia"))))
777 (build-system meson-build-system)
778 (arguments
779 (list
780 #:phases
781 #~(modify-phases %standard-phases
782 (add-before 'check 'start-xserver
783 ;; Tests require a running X server.
784 (lambda* (#:key inputs #:allow-other-keys)
785 (let ((display ":1"))
786 (setenv "DISPLAY" display)
787
788 ;; On busy machines, tests may take longer than
789 ;; the default of four seconds.
790 (setenv "CK_DEFAULT_TIMEOUT" "20")
791
792 ;; Don't fail due to missing '/etc/machine-id'.
793 (setenv "DBUS_FATAL_WARNINGS" "0")
794 (zero? (system (string-append
795 (search-input-file inputs "/bin/Xvfb")
796 " " display " &")))))))))
797 (native-inputs
798 (list pkg-config
799 gettext-minimal
800 (list glib "bin")
801
802 ;; For building documentation.
803 python-sphinx
804
805 ;; For building icons.
806 (librsvg-for-system)
807
808 ;; For tests.
809 xorg-server-for-tests))
810 (inputs (list json-glib sqlite))
811 (propagated-inputs (list girara gtk+))
812 (native-search-paths
813 (list (search-path-specification
814 (variable "ZATHURA_PLUGINS_PATH")
815 (files '("lib/zathura")))))
816 (home-page "https://pwmt.org/projects/zathura/")
817 (synopsis "Lightweight keyboard-driven PDF viewer")
818 (description "Zathura is a customizable document viewer. It provides a
819minimalistic interface and an interface that mainly focuses on keyboard
820interaction.")
821 (license license:zlib)))
822
823(define-public podofo-0.9
824 (package
825 (name "podofo")
826 (version "0.9.8")
827 (source (origin
828 (method git-fetch)
829 (uri (git-reference
830 (url "https://github.com/podofo/podofo")
831 (commit version)))
832 (file-name (git-file-name name version))
833 (patches (search-patches "podofo-gcc-14.patch"))
834 (sha256
835 (base32
836 "1fyv0zbl6zs93wy0qb3mjkfm99pgz5275nkzss115ww2w04h0ssl"))))
837 (build-system cmake-build-system)
838 (native-inputs
839 (list cppunit pkg-config))
840 (inputs
841 (list fontconfig
842 freetype
843 libjpeg-turbo
844 libpng
845 libtiff
846 lua-5.1
847 openssl
848 zlib))
849 (arguments
850 (list
851 #:tests? #f
852 #:configure-flags
853 #~(list "-DPODOFO_BUILD_SHARED=ON")
854 #:phases
855 #~(modify-phases %standard-phases
856 (add-before 'configure 'patch
857 (lambda _
858 ;; Look for freetype include files in the correct place.
859 (substitute* "cmake/modules/FindFREETYPE.cmake"
860 (("/usr/local") #$freetype)))))))
861 (home-page "https://github.com/podofo/podofo")
862 (synopsis "Tools to work with the PDF file format")
863 (description
864 "PoDoFo is a C++ library and set of command-line tools to work with the
865PDF file format. It can parse PDF files and load them into memory, and makes
866it easy to modify them and write the changes to disk. It is primarily useful
867for applications that wish to do lower level manipulation of PDF, such as
868extracting content or merging files.")
869 (license license:lgpl2.0+)))
870
871(define-public podofo
872 (package
873 (name "podofo")
874 (version "0.10.4")
875 (source (origin
876 (method git-fetch)
877 (uri (git-reference
878 (url "https://github.com/podofo/podofo")
879 (commit version)))
880 (file-name (git-file-name name version))
881 (sha256
882 (base32
883 "1ffdx3ghz0an3fkz72m0q77g5ipcriapxnphha20gk4b575a93v5"))))
884 (build-system cmake-build-system)
885 (native-inputs
886 (list cppunit pkg-config))
887 (inputs
888 (list fontconfig
889 freetype
890 libjpeg-turbo
891 libpng
892 libtiff
893 libxml2
894 lua-5.1
895 openssl
896 zlib))
897 (arguments
898 (list #:tests? #f))
899 (home-page "https://github.com/podofo/podofo")
900 (synopsis "Tools to work with the PDF file format")
901 (description
902 "PoDoFo is a C++ library and set of command-line tools to work with the
903PDF file format. It can parse PDF files and load them into memory, and makes
904it easy to modify them and write the changes to disk. It is primarily useful
905for applications that wish to do lower level manipulation of PDF, such as
906extracting content or merging files.")
907 (license license:lgpl2.0+)))
908
909(define-public python-pydyf
910 (package
911 (name "python-pydyf")
912 (version "0.12.1")
913 (source
914 (origin
915 (method git-fetch)
916 (uri (git-reference
917 (url "https://github.com/CourtBouillon/pydyf")
918 (commit (string-append "v" version))))
919 (file-name (git-file-name name version))
920 (sha256
921 (base32 "0fq5d692hpfd7f6n3sb78l0jxq0ivin3867fi4yqjc0swcd35j8b"))))
922 (build-system pyproject-build-system)
923 (native-inputs
924 (list ghostscript
925 python-flit-core
926 python-pytest))
927 (propagated-inputs
928 (list python-pillow))
929 (home-page "https://github.com/CourtBouillon/pydyf")
930 (synopsis "Low-level PDF generator")
931 (description "@code{pydyf} is a low-level PDF generator written in Python
932and based on PDF specification 1.7.")
933 (license license:bsd-3)))
934
935(define-public mupdf
936 (package
937 (name "mupdf")
938 (version "1.27.2")
939 (source
940 (origin
941 (method url-fetch)
942 (uri (string-append "https://mupdf.com/downloads/archive/"
943 "mupdf-" version "-source.tar.lz"))
944 (sha256
945 (base32 "0j183r32hifygcxk76a7sh71x9a1dfylpsx1rki1nm0s1g6rs11m"))
946 (modules '((guix build utils)
947 (ice-9 ftw)
948 (srfi srfi-1)))
949 (snippet
950 ;; Remove bundled software. Keep patched variants.
951 #~(with-directory-excursion "thirdparty"
952 (let ((keep '("README"
953 "extract"
954 "freeglut"
955 ;; As of 1.27.x contains required non-public headers
956 ;; This now is always statically compiled in.
957 "mujs"
958 "lcms2")))
959 (for-each delete-file-recursively
960 (lset-difference string=?
961 (scandir ".")
962 (cons* "." ".." keep))))))))
963 (build-system gnu-build-system)
964 (inputs
965 (list brotli
966 curl
967 libxrandr
968 libxi
969 freeglut ;for GL/gl.h
970 freetype
971 gumbo-parser
972 harfbuzz
973 jbig2dec
974 leptonica
975 libjpeg-turbo
976 libx11
977 libxext
978 openjpeg
979 openssl
980 tesseract-ocr
981 zlib))
982 (native-inputs
983 (list pkg-config
984 python-3
985 python-clang-13
986 swig-4.4))
987 (arguments
988 (list
989 #:tests? #f ;no check target
990 #:make-flags
991 #~(list "verbose=yes"
992 (string-append "CC=" #$(cc-for-target))
993 "XCFLAGS=-fpic"
994 "USE_SYSTEM_BROTLI=yes"
995 "USE_SYSTEM_FREETYPE=yes"
996 "USE_SYSTEM_GUMBO=yes"
997 "USE_SYSTEM_HARFBUZZ=yes"
998 "USE_SYSTEM_JBIG2DEC=yes"
999 "USE_SYSTEM_JPEGXR=no # not available"
1000 "USE_SYSTEM_LCMS2=no # lcms2mt is strongly preferred"
1001 "USE_SYSTEM_LIBJPEG=yes"
1002 "USE_SYSTEM_OPENJPEG=yes"
1003 "USE_SYSTEM_ZLIB=yes"
1004 "USE_SYSTEM_GLUT=no"
1005 "USE_SYSTEM_CURL=yes"
1006 "USE_SYSTEM_LEPTONICA=yes"
1007 "USE_SYSTEM_TESSERACT=yes"
1008 "shared=yes"
1009 (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib")
1010 (string-append "prefix=" #$output))
1011 #:phases
1012 #~(modify-phases %standard-phases
1013 (delete 'configure) ;no configure script
1014 (add-after 'install 'install-python
1015 (lambda* (#:key make-flags #:allow-other-keys)
1016 (substitute* "Makefile"
1017 (("\\(pydir\\)")
1018 (format #f "(prefix)/lib/python~s/site-packages"
1019 #$(version-major+minor
1020 (package-version
1021 (this-package-native-input "python"))))))
1022 (apply invoke
1023 "make"
1024 "install-shared-python"
1025 "USE_SYSTEM_LIBS=yes"
1026 "HAVE_LEPTONICA=yes"
1027 "HAVE_TESSERACT=yes"
1028 "VENV_FLAG="
1029 make-flags))))))
1030 (home-page "https://mupdf.com")
1031 (synopsis "Lightweight PDF viewer and toolkit")
1032 (description
1033 "MuPDF is a C library that implements a PDF and XPS parsing and
1034rendering engine. It is used primarily to render pages into bitmaps,
1035but also provides support for other operations such as searching and
1036listing the table of contents and hyperlinks.
1037
1038The library ships with a rudimentary X11 viewer, and a set of command
1039line tools for batch rendering @command{pdfdraw}, rewriting files
1040@command{pdfclean}, and examining the file structure @command{pdfshow}.")
1041 (license (list license:agpl3+
1042 license:bsd-3 ;resources/cmaps
1043 license:x11 ;thirdparty/lcms2
1044 license:silofl1.1 ;resources/fonts/{han,noto,sil,urw}
1045 license:asl2.0)))) ; resources/fonts/droid
1046
1047(define-public python-pymupdf-fonts
1048 (package
1049 (name "python-pymupdf-fonts")
1050 (version "1.0.4")
1051 (source
1052 (origin
1053 (method git-fetch)
1054 (uri (git-reference
1055 (url "https://github.com/pymupdf/pymupdf-fonts")
1056 (commit version)))
1057 (file-name (git-file-name name version))
1058 (sha256
1059 (base32
1060 "05yhdlq96fv8hw7kq1qjy3hcnf58bph53b62jlg6976cjzimdabc"))))
1061 (build-system pyproject-build-system)
1062 (arguments
1063 (list #:tests? #f)) ; no tests
1064 (native-inputs (list python-setuptools))
1065 (home-page "https://github.com/pymupdf/pymupdf-fonts")
1066 (synopsis "Collection of font binaries for use in PyMuPDF")
1067 (description "This package contains a collection of fonts for use in
1068@code{PyMuPDF}. It contains fonts from the Cascadia Mono, Fira Mono, FiraGO,
1069Noto Sans, Space Mono and Ubuntu families.")
1070 (license license:silofl1.1)))
1071
1072(define-public python-pymupdf
1073 (package
1074 (name "python-pymupdf")
1075 (version "1.27.2.2")
1076 (source
1077 (origin
1078 (method git-fetch)
1079 (uri (git-reference
1080 (url "https://github.com/pymupdf/PyMuPDF")
1081 (commit version)))
1082 (file-name (git-file-name name version))
1083 (sha256
1084 (base32
1085 "00mdx8vz8zf6fckhyzaydfnqvs281245pvnddzz3b3mqmqqhigd3"))))
1086 (build-system pyproject-build-system)
1087 (arguments
1088 (list
1089 #:test-flags #~(list
1090 ;; barcode functionality is not included in our build
1091 "--ignore=tests/test_barcode.py"
1092 ;; test_codespell tries to run tests based on git
1093 ;; checkout, which is not present
1094 "--ignore=tests/test_codespell.py"
1095 ;; test_font tries to run pip, thus fails
1096 "--ignore=tests/test_font.py"
1097 ;; test_general tries to run pip, thus fails
1098 "--ignore=tests/test_general.py"
1099 ;; test_pixmap tries to run pip, thus fails
1100 "--ignore=tests/test_pixmap.py"
1101 ;; test_pylint tries to run tests based on git checkout,
1102 ;; which is not present
1103 "--ignore=tests/test_pylint.py"
1104 ;; test_2979 in test_tables fails for unknown reasons
1105 "--ignore=tests/test_tables.py"
1106 ;; test_textbox errors at teardown of test_textbox3 for
1107 ;; unknown reasons
1108 "--ignore=tests/test_textbox.py"
1109 ;; tesseract ocr integration appears to not work
1110 "--ignore=tests/test_tesseract.py"
1111 "--ignore=tests/test_textextract.py")
1112 #:phases #~(modify-phases %standard-phases
1113 (add-after 'unpack 'patch-tests
1114 ;; The test suite wants to run pip to automatically install
1115 ;; packages required for the test suite, so we disable that.
1116 (lambda _
1117 (substitute* "tests/conftest.py"
1118 (("command = f'pip install --upgrade \\{packages\\}'") "command = 'echo noop'"))))
1119 (add-before 'build 'configure-libraries
1120 (lambda* (#:key inputs #:allow-other-keys)
1121 (setenv "PYMUPDF_INCLUDES"
1122 (string-join
1123 (list
1124 (search-input-directory inputs "include/freetype2")
1125 (search-input-directory inputs "include/mupdf"))
1126 ":"))
1127 (setenv "PYMUPDF_SETUP_MUPDF_BUILD" "")
1128 (setenv "PYMUPDF_MUPDF_LIB"
1129 (format #f "~a/lib"
1130 #$(this-package-input "mupdf")))
1131 (setenv "PYMUPDF_SETUP_MUPDF_REBUILD" "0")
1132 (setenv "PYMUPDF_SETUP_MUPDF_OVERWRITE_CONFIG" "0,")
1133 (setenv "PYMUPDF_SETUP_IMPLEMENTATIONS" "a")
1134 (setenv "CC" #$(cc-for-target))
1135 (setenv "CXX" #$(cxx-for-target)))))))
1136 (inputs (list freetype
1137 gumbo-parser
1138 harfbuzz
1139 jbig2dec
1140 libjpeg-turbo
1141 openjpeg
1142 psutils
1143 tesseract-ocr))
1144 (propagated-inputs (list mupdf
1145 python-fonttools
1146 python-pillow
1147 python-pymupdf-fonts))
1148 (native-inputs (list python-codespell
1149 python-flake8
1150 python-mypy ;for tests
1151 python-psutil ;for tests
1152 python-pylint
1153 python-pytest
1154 python-setuptools
1155 swig-4.4))
1156 (home-page "https://github.com/pymupdf/PyMuPDF")
1157 (synopsis "Python bindings for the PDF toolkit and renderer MuPDF")
1158 (description "PyMuPDF is a set of Python bindings for MuPDF,
1159which is a viewer, renderer, and toolkit for files in @acronym{PDF, Portable
1160Document Format}, @acronym{XPS, XML Paper Specification}, @acronym{OpenXPS,
1161Open XML Paper Specification}, @acronym{CBZ, Comic Book ZI}P, @acronym{EPUB,
1162Electronic Publication} and @acronym{FB2, Fiction Book 2} (e-books) format.")
1163 (license license:agpl3)))
1164
1165(define-public pdf-tocgen
1166 (package
1167 (name "pdf-tocgen")
1168 (version "1.3.4")
1169 (source
1170 (origin
1171 (method git-fetch)
1172 (uri (git-reference
1173 (url "https://github.com/Krasjet/pdf.tocgen")
1174 (commit (string-append "v" version))))
1175 (file-name (git-file-name name version))
1176 (sha256
1177 (base32 "0sqqnrw6zw2awcf9g6v66fm9nnrv2xm3l5ql1liq9skilkjkgkx3"))))
1178 (build-system pyproject-build-system)
1179 (arguments
1180 (list
1181 ;; A required file is missing, seemingly causing the test suite to fail,
1182 ;; see https://github.com/Krasjet/pdf.tocgen/issues/41
1183 #:tests? #f))
1184 (native-inputs
1185 (list python-poetry-core))
1186 (propagated-inputs
1187 (list python-chardet
1188 python-jedi
1189 python-pymupdf
1190 python-toml))
1191 (home-page "https://krasjet.com/voice/pdf.tocgen/")
1192 (synopsis "Automatically generate table of contents for pdf files")
1193 (description "pdf.tocgen is a set of command-line tools for automatically
1194extracting and generating the table of contents of a PDF file. It uses
1195the embedded font attributes and position of headings to deduce the basic
1196outline of a PDF file.
1197
1198It works best for PDF files produced from a TeX document, but it's designed to
1199work with any software-generated PDF files (i.e. you shouldn't expect it to
1200work with scanned PDFs). Some examples include troff/groff, Adobe InDesign,
1201LibreOffice Writer, and probably more.")
1202 (license license:gpl3+)))
1203
1204(define-public qpdf
1205 (package
1206 (name "qpdf")
1207 (version "11.8.0")
1208 (source (origin
1209 (method url-fetch)
1210 (uri (string-append "mirror://sourceforge/qpdf/qpdf/" version
1211 "/qpdf-" version ".tar.gz"))
1212 (sha256
1213 (base32
1214 "0n8jfk4yf0m36rs9lg82pj9lv6pdqpfh8mhacc1ih9ahpigiycnr"))))
1215 (build-system cmake-build-system)
1216 (arguments
1217 (list #:configure-flags #~'("-DBUILD_STATIC_LIBS=OFF")))
1218 (native-inputs
1219 (list perl pkg-config))
1220 (propagated-inputs
1221 ;; In Requires.private of libqpdf.pc.
1222 (list libjpeg-turbo zlib))
1223 (synopsis "Command-line tools and library for transforming PDF files")
1224 (description
1225 "QPDF is a command-line program that does structural, content-preserving
1226transformations on PDF files. It could have been called something like
1227pdf-to-pdf. It includes support for merging and splitting PDFs and to
1228manipulate the list of pages in a PDF file. It is not a PDF viewer or a
1229program capable of converting PDF into other formats.")
1230 ;; Prior to the 7.0 release, QPDF was licensed under Artistic 2.0.
1231 ;; Users can still choose to use the old license at their option.
1232 (license (list license:asl2.0 license:clarified-artistic))
1233 (home-page "https://qpdf.sourceforge.io/")))
1234
1235(define-public qpdfview
1236 (package
1237 (name "qpdfview")
1238 (version "0.5.0")
1239 (source
1240 (origin
1241 (method url-fetch)
1242 (uri (string-append "https://launchpad.net/qpdfview/"
1243 "trunk/" version "/+download/"
1244 "qpdfview-" (version-major+minor version) ".tar.gz"))
1245 (sha256
1246 (base32 "16dy341927r2s1dza7g8ci1jyypfc4a6yfcvg9sxvjv1li0c9vs4"))))
1247 (build-system qt-build-system)
1248 (native-inputs
1249 (list pkg-config))
1250 (inputs
1251 (list cups
1252 djvulibre
1253 libspectre
1254 poppler-qt6
1255 qtsvg
1256 qtwayland))
1257 (arguments
1258 (list #:qtbase qtbase
1259 #:tests? #f ; no tests
1260 #:modules '((guix build qt-build-system)
1261 ((guix build gnu-build-system) #:prefix gnu:)
1262 (guix build utils))
1263 #:phases
1264 #~(modify-phases %standard-phases
1265 (replace 'configure
1266 (lambda _
1267 (substitute* "qpdfview.pri"
1268 (("/usr") #$output)
1269 ;; Poppler >= 23.06.0 uses C++17 in its public headers.
1270 (("c\\+\\+11") "c++17"))
1271 (invoke "qmake" "qpdfview.pro")))
1272 (replace 'build (assoc-ref gnu:%standard-phases 'build))
1273 (replace 'install (assoc-ref gnu:%standard-phases 'install)))))
1274 (home-page "https://launchpad.net/qpdfview")
1275 (synopsis "Tabbed document viewer")
1276 (description "@command{qpdfview} is a document viewer for PDF, PS and DJVU
1277files. It uses the Qt toolkit and features persistent per-file settings,
1278configurable toolbars and shortcuts, continuous and multi‐page layouts,
1279SyncTeX support, and rudimentary support for annotations and forms.")
1280 (license license:gpl2+)))
1281
1282(define-public unpaper
1283 (package
1284 (name "unpaper")
1285 (version "7.0.0")
1286 (source
1287 (origin
1288 (method url-fetch)
1289 (uri (string-append "https://www.flameeyes.com/files/unpaper-"
1290 version ".tar.xz"))
1291 (sha256
1292 (base32 "103awjdl2qrzi0qc32hi8zvwf04r5ih5jaw8rg8ij9y24szznx95"))))
1293 (native-inputs
1294 (list pkg-config python-sphinx))
1295 (inputs
1296 (list discount ffmpeg))
1297 (build-system meson-build-system)
1298 (home-page "https://www.flameeyes.com/projects/unpaper")
1299 (synopsis "Post-processing tool for scanned pages")
1300 (description "@command{unpaper} is a post-processing tool for
1301scanned sheets of paper, especially for book pages that have been
1302scanned from previously created photocopies.
1303
1304Its main purpose is to make scanned book pages better readable on screen
1305after conversion to PDF. Additionally, unpaper might be useful to
1306enhance the quality of scanned pages before performing
1307@acronym{OCR, optical character recognition}.")
1308 (license license:gpl2)))
1309
1310(define-public xournal
1311 (package
1312 (name "xournal")
1313 (version "0.4.8.2016")
1314 (source
1315 (origin
1316 (method url-fetch)
1317 (uri (string-append "mirror://sourceforge/xournal/xournal/" version
1318 "/xournal-" version ".tar.gz"))
1319 (sha256
1320 (base32
1321 "09i88v3wacmx7f96dmq0l3afpyv95lh6jrx16xzm0jd1szdrhn5j"))))
1322 (build-system gnu-build-system)
1323 (arguments
1324 (list
1325 #:make-flags
1326 #~(list (string-append "CFLAGS=-g -O2 "
1327 ;; Placate gcc@14 strictness.
1328 "-Wno-error=deprecated-declarations "
1329 "-Wno-error=implicit-function-declaration"))
1330 #:phases
1331 #~(modify-phases %standard-phases
1332 (add-after 'unpack 'fix-includes
1333 ;; Inclusion of unistd.h is conditional on HAVE_UNISTD_H being
1334 ;; defined, but this comes from config.h.
1335 (lambda _
1336 (with-fluids ((%default-port-encoding "ISO-8859-1"))
1337 (substitute* "src/ttsubset/sft.h"
1338 (("#include <sys/types.h>")
1339 "#include \"config.h\"\n#include <sys/types.h>"))))))))
1340 (inputs
1341 (list gtk+-2 pango poppler glib libgnomecanvas))
1342 (native-inputs
1343 (list pkg-config))
1344 (home-page "https://xournal.sourceforge.net/")
1345 (synopsis "Notetaking using a stylus")
1346 (description
1347 "Xournal is an application for notetaking, sketching, keeping a journal
1348using a stylus.")
1349 (license license:gpl2+)))
1350
1351(define-public xournalpp
1352 (package
1353 (name "xournalpp")
1354 (version "1.3.5")
1355 (source
1356 (origin
1357 (method git-fetch)
1358 (uri (git-reference
1359 (url "https://github.com/xournalpp/xournalpp")
1360 (commit (string-append "v" version))))
1361 (file-name (git-file-name name version))
1362 (sha256
1363 (base32 "01f4hvwrpx3wkvyqrjl5bmd7vsdiicxw3dga5wxkifks3qx7vw16"))))
1364 (build-system cmake-build-system)
1365 (arguments
1366 (list
1367 #:generator "Ninja"
1368 ;; FIXME: Building the tests fails if DOWNLOAD_GTEST is off. Ignore
1369 ;; them for now.
1370 #:tests? #false
1371 #:configure-flags
1372 #~(list "-DENABLE_GTEST=ON"
1373 "-DENABLE_CPPTRACE=OFF") ;require unpackaged "cpp-trace"
1374 #:imported-modules `((guix build glib-or-gtk-build-system)
1375 ,@%cmake-build-system-modules)
1376 #:modules '(((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:)
1377 (guix build cmake-build-system)
1378 (guix build utils))
1379 #:phases
1380 #~(modify-phases %standard-phases
1381 ;; Fix path to addr2line utility, which the crash reporter uses.
1382 (add-after 'unpack 'fix-paths
1383 (lambda* (#:key inputs #:allow-other-keys)
1384 (substitute* "src/util/Stacktrace.cpp"
1385 ;; Match only the commandline.
1386 (("\"addr2line ")
1387 (string-append "\""
1388 (search-input-file inputs "/bin/addr2line")
1389 " ")))))
1390 (add-after 'build 'prepare-tests
1391 (lambda* (#:key tests? #:allow-other-keys)
1392 (when tests?
1393 (invoke "cmake" "--build" "." "--target" "test-units"))))
1394 (add-after 'install 'glib-or-gtk-wrap
1395 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap))
1396 (add-after 'unpack 'generate-gdk-pixbuf-loaders-cache-file
1397 (assoc-ref glib-or-gtk:%standard-phases
1398 'generate-gdk-pixbuf-loaders-cache-file))
1399 (add-after 'glib-or-gtk-wrap 'wrap-gdk-pixbuf
1400 ;; This phase is necessary for xournalpp to load SVG icons and
1401 ;; access gtksourceview-4/styles.
1402 (lambda* (#:key inputs #:allow-other-keys)
1403 (let ((pixbuf-module-file (getenv "GDK_PIXBUF_MODULE_FILE"))
1404 (gtksourceview-4-resources
1405 (dirname
1406 (search-input-directory inputs "share/gtksourceview-4"))))
1407 (wrap-program (string-append #$output "/bin/xournalpp")
1408 `("GDK_PIXBUF_MODULE_FILE" = (,pixbuf-module-file))
1409 `("XDG_DATA_DIRS" ":" prefix
1410 (,gtksourceview-4-resources))))))
1411 (add-after 'patch-dot-desktop-files 'patch-dot-thumbnailer-files
1412 (lambda _
1413 (define abs-path (string-append #$output "/bin/xournalpp-thumbnailer"))
1414 (substitute* (string-append #$output "/share/thumbnailers/com.github.xournalpp.xournalpp.thumbnailer")
1415 (("TryExec=xournalpp-thumbnailer")
1416 (format #f "TryExec=~a" abs-path))
1417 (("Exec=xournalpp-thumbnailer")
1418 (format #f "Exec=~a" abs-path))))))))
1419 (native-inputs
1420 (list cppunit
1421 gettext-minimal
1422 `(,glib "bin") ;for glib-compile-resources
1423 googletest
1424 help2man
1425 ninja
1426 pkg-config))
1427 (inputs
1428 (list adwaita-icon-theme
1429 alsa-lib
1430 bash-minimal
1431 gtk+
1432 gtksourceview-4
1433 (librsvg-for-system)
1434 libsndfile
1435 libxml2
1436 libzip
1437 lua
1438 poppler
1439 portaudio
1440 qpdf))
1441 (home-page "https://github.com/xournalpp/xournalpp")
1442 (synopsis "Handwriting notetaking software with PDF annotation support")
1443 (description "Xournal++ is a hand note taking software written in
1444C++ with the target of flexibility, functionality and speed. Stroke
1445recognizer and other parts are based on Xournal code.
1446
1447Xournal++ features:
1448
1449@itemize
1450@item Support for Pen pressure, e.g., Wacom Tablet
1451@item Support for annotating PDFs
1452@item Fill shape functionality
1453@item PDF Export (with and without paper style)
1454@item PNG Export (with and without transparent background)
1455@item Map different tools / colors etc. to stylus buttons /
1456mouse buttons
1457@item Sidebar with Page Previews with advanced page sorting, PDF
1458Bookmarks and Layers (can be individually hidden, editing layer can be
1459selected)
1460@item enhanced support for image insertion
1461@item Eraser with multiple configurations
1462@item LaTeX support
1463@item bug reporting, autosave, and auto backup tools
1464@item Customizable toolbar, with multiple configurations, e.g., to
1465optimize toolbar for portrait / landscape
1466@item Page Template definitions
1467@item Shape drawing (line, arrow, circle, rectangle)
1468@item Shape resizing and rotation
1469@item Rotation snapping every 45 degrees
1470@item Rect snapping to grid
1471@item Audio recording and playback alongside with handwritten notes
1472@item Multi Language Support, Like English, German, Italian...
1473@item Plugins using LUA Scripting
1474@end itemize")
1475 (license license:gpl2+)))
1476
1477(define-public python-reportlab
1478 (package
1479 (name "python-reportlab")
1480 (version "4.4.7")
1481 (source (origin
1482 (method url-fetch)
1483 (uri (pypi-uri "reportlab" version))
1484 (sha256
1485 (base32
1486 "0w5isxc1ds19jhpigfjjyavc6qzkwxskwgwkcikrkrb5z5x2is21"))))
1487 (build-system pyproject-build-system)
1488 (arguments
1489 (list
1490 ;; tests: 386 passed
1491 #:test-backend #~'custom
1492 #:test-flags #~(list "runAll.py")
1493 #:configure-flags #~'(("--no-download-t1-files" . ""))
1494 #:phases
1495 #~(modify-phases %standard-phases
1496 (add-after 'unpack 'find-libraries
1497 (lambda* (#:key inputs #:allow-other-keys)
1498 (let ((dlt1 (assoc-ref inputs "font-curve-files")))
1499 (substitute* "setup.py"
1500 (("http://www.reportlab.com/ftp/pfbfer-20180109.zip")
1501 (string-append "file://" dlt1))))))
1502 (replace 'check
1503 (lambda args
1504 ;; KeyError: 'Vera'
1505 (delete-file "tests/test_graphics_charts.py")
1506 (with-directory-excursion "tests"
1507 (apply (assoc-ref %standard-phases 'check) args)))))))
1508 (native-inputs (list python-setuptools))
1509 (inputs
1510 `(("font-curve-files"
1511 ,(origin
1512 (method url-fetch)
1513 (uri "http://www.reportlab.com/ftp/pfbfer-20180109.zip")
1514 (sha256
1515 (base32
1516 "1v0gy4mbx02ys96ssx89420y0njknlrxs2bx64bv4rp8a0al66w5"))))))
1517 (propagated-inputs
1518 (list python-charset-normalizer python-pillow))
1519 (home-page "https://www.reportlab.com")
1520 (synopsis "Python library for generating PDFs and graphics")
1521 (description "This is the ReportLab PDF Toolkit. It allows rapid creation
1522of rich PDF documents, and also creation of charts in a variety of bitmap and
1523vector formats.")
1524 (license license:bsd-3)))
1525
1526(define-public impressive
1527 (package
1528 (name "impressive")
1529 ;; (version "0.13.1")
1530 (version "0.13.2")
1531 (source
1532 (origin
1533 (method url-fetch)
1534 (uri (string-append "mirror://sourceforge/impressive/Impressive/"
1535 version "/Impressive-" version ".tar.gz"))
1536 (sha256
1537 (base32
1538 ;; "0d1d2jxfl9vmy4swcdz660xd4wx91w1i3n07k522pccapwxig294"))))
1539 "0g15q67f992prkjndrk75hhd601iypfmkafhdx7hijs2byr26c83"))))
1540 (build-system pyproject-build-system)
1541 (arguments
1542 (list
1543 #:tests? #f ;No tests.
1544 #:phases
1545 #~(modify-phases %standard-phases
1546 (delete 'build)
1547 (delete 'configure)
1548 (replace 'install
1549 (lambda* (#:key inputs #:allow-other-keys)
1550 ;; There's no 'setup.py' so install things manually.
1551 (let* ((bin (string-append #$output "/bin"))
1552 (impressive (string-append bin "/impressive"))
1553 (man1 (string-append #$output "/share/man/man1")))
1554 (mkdir-p bin)
1555 (copy-file "impressive.py" impressive)
1556 (chmod impressive #o755)
1557 (wrap-program (string-append bin "/impressive")
1558 `("PATH" ":" prefix ;for pdftoppm
1559 (,(search-input-file inputs "bin/xpdf"))))
1560 (install-file "impressive.1" man1)))))))
1561 (native-inputs (list python-setuptools))
1562 ;; TODO: Add dependency on pdftk.
1563 (inputs (list bash-minimal python-pygame python-pillow sdl xpdf))
1564 (home-page "https://impressive.sourceforge.net")
1565 (synopsis "PDF presentation tool with visual effects")
1566 (description
1567 "Impressive is a tool to display PDF files that provides visual effects
1568such as smooth alpha-blended slide transitions. It provides additional tools
1569such as zooming, highlighting an area of the screen, and a tool to navigate
1570the PDF pages.")
1571 (license license:gpl2)))
1572
1573(define-public img2pdf
1574 (package
1575 (name "img2pdf")
1576 (version "0.6.1")
1577 (source
1578 (origin
1579 (method url-fetch)
1580 (uri (pypi-uri "img2pdf" version))
1581 (sha256
1582 (base32 "12gjd98gnx117d5v36gpw55iplgvm6bvd532gnfibg1jp2g2fvih"))))
1583 (build-system pyproject-build-system)
1584 (arguments
1585 ;; TODO: See: <https://codeberg.org/guix/guix/issues/4932#issuecomment-9045882>.
1586 (list #:tests? #f))
1587 (native-inputs
1588 (list python-setuptools))
1589 (inputs
1590 (list python-pikepdf
1591 python-pillow
1592 `(,python "tk")))
1593 (home-page "https://gitlab.mister-muffin.de/josch/img2pdf")
1594 (synopsis "Convert images to PDF via direct JPEG inclusion")
1595 (description
1596 "img2pdf converts images to PDF via direct JPEG inclusion. That
1597conversion is lossless: the image embedded in the PDF has the exact same color
1598information for every pixel as the input.")
1599 (license license:lgpl3)))
1600
1601(define-public fbida
1602 (package
1603 (name "fbida")
1604 (version "2.14")
1605 (home-page "https://www.kraxel.org/blog/linux/fbida/")
1606 (source (origin
1607 (method url-fetch)
1608 (uri (string-append "https://www.kraxel.org/releases/fbida/"
1609 "fbida-" version ".tar.gz"))
1610 (sha256
1611 (base32
1612 "0f242mix20rgsqz1llibhsz4r2pbvx6k32rmky0zjvnbaqaw1dwm"))))
1613 (build-system gnu-build-system)
1614 (arguments
1615 (list
1616 #:phases #~(modify-phases %standard-phases
1617 (add-after 'unpack 'patch-FHS-file-names
1618 (lambda _
1619 (substitute* "mk/Autoconf.mk"
1620 (("/bin/echo") "echo")
1621 (("/sbin/ldconfig -p") "echo lib"))))
1622 (add-before 'build 'set-fcommon
1623 (lambda _
1624 (setenv "CFLAGS" "-fcommon")))
1625 (delete 'configure))
1626 #:tests? #f
1627 #:make-flags #~(list (string-append "CC=" #+(cc-for-target))
1628 (string-append "prefix=" #$output))))
1629 (inputs
1630 (list cairo-xcb
1631 curl
1632 eudev
1633 fontconfig
1634 freetype
1635 giflib
1636 glib
1637 libdrm
1638 libepoxy
1639 libexif
1640 libjpeg-turbo
1641 libpng
1642 libtiff
1643 libwebp
1644 mesa
1645 poppler))
1646 (native-inputs (list pkg-config))
1647 (synopsis "Framebuffer and drm-based image viewer")
1648 (description
1649 "fbida contains a few applications for viewing and editing images on
1650the framebuffer.")
1651 (license license:gpl2+)))
1652
1653(define-public pdfcrack
1654 (package
1655 (name "pdfcrack")
1656 (version "0.20")
1657 (source (origin
1658 (method url-fetch)
1659 (uri (string-append "mirror://sourceforge/pdfcrack/pdfcrack/"
1660 "pdfcrack-" version "/"
1661 "pdfcrack-" version ".tar.gz"))
1662 (sha256
1663 (base32
1664 "1d751n38cbagxqpw6ncvf3jfv7zhxl3fwh5nms2bjp6diyqjk2vv"))))
1665 (build-system gnu-build-system)
1666 (arguments
1667 (list #:tests? #f ;no test suite
1668 #:make-flags #~(list (string-append "CC="
1669 #$(cc-for-target)))
1670 #:phases #~(modify-phases %standard-phases
1671 (delete 'configure) ;no configure script
1672 (replace 'install
1673 (lambda _
1674 (install-file "pdfcrack"
1675 (string-append #$output "/bin")))))))
1676 (home-page "https://pdfcrack.sourceforge.net/")
1677 (synopsis "Password recovery tool for PDF files")
1678 (description "PDFCrack is a simple tool for recovering passwords from PDF
1679documents that use the standard security handler.")
1680 (license license:gpl2+)))
1681
1682(define-public pdf2svg
1683 (package
1684 (name "pdf2svg")
1685 (version "0.2.3")
1686 (source (origin
1687 (method git-fetch)
1688 (uri (git-reference
1689 (url "https://github.com/dawbarton/pdf2svg")
1690 (commit (string-append "v" version))))
1691 (file-name (git-file-name name version))
1692 (sha256
1693 (base32
1694 "14ffdm4y26imq99wjhkrhy9lp33165xci1l5ndwfia8hz53bl02k"))))
1695 (build-system gnu-build-system)
1696 (inputs
1697 (list cairo poppler))
1698 (native-inputs
1699 (list pkg-config))
1700 (home-page "http://www.cityinthesky.co.uk/opensource/pdf2svg/")
1701 (synopsis "PDF to SVG converter")
1702 (description "@command{pdf2svg} is a simple command-line PDF to SVG
1703converter using the Poppler and Cairo libraries.")
1704 (license license:gpl2+)))
1705
1706(define-public python-pypdf
1707 (package
1708 (name "python-pypdf")
1709 (version "6.9.2")
1710 (source
1711 (origin
1712 (method git-fetch)
1713 (uri (git-reference
1714 (url "https://github.com/py-pdf/pypdf")
1715 (commit version)))
1716 (file-name (git-file-name name version))
1717 (sha256
1718 (base32 "1x0v1h7783baxqqgm77sdc6qdzckzd3fz8wqxic4bc8bp9f0cagn"))))
1719 (build-system pyproject-build-system)
1720 (arguments
1721 (list
1722 ;; tests: 721 passed, 15 skipped, 434 deselected
1723 #:test-flags
1724 ;; Disable tests that use the network and non-free assets.
1725 #~(list "-m" "not samples and not enable_socket"
1726 ;; OSError: broken data stream when writing image file
1727 (string-append "--deselect=tests/generic/test_image_xobject.py"
1728 "::test_handle_jpx__explicit_decode"))))
1729 (native-inputs
1730 (list python-flit-core
1731 python-pytest
1732 python-pytest-socket
1733 python-pytest-timeout
1734 python-pyyaml))
1735 (propagated-inputs
1736 (list python-pillow))
1737 (home-page "https://github.com/py-pdf/pypdf")
1738 (synopsis "Python PDF library")
1739 (description
1740 "This package provides a PDF library capable of splitting, merging,
1741cropping, and transforming PDF files.")
1742 (license license:bsd-3)))
1743
1744(define-public pdfarranger
1745 (package
1746 (name "pdfarranger")
1747 (version "1.13.0")
1748 (source
1749 (origin
1750 (method git-fetch)
1751 (uri (git-reference
1752 (url "https://github.com/pdfarranger/pdfarranger")
1753 (commit version)))
1754 (file-name (git-file-name name version))
1755 (sha256
1756 (base32 "0kndvvi6cx2qhkf086zd6b61sp7x5hgrxacx5hlxmmv4chab76wm"))))
1757 (build-system pyproject-build-system)
1758 (arguments
1759 (list
1760 #:phases
1761 #~(modify-phases %standard-phases
1762 (add-after 'wrap 'wrap-for-typelib
1763 (lambda _
1764 (let ((program (string-append #$output "/bin/pdfarranger")))
1765 (wrap-program program
1766 `("GI_TYPELIB_PATH" ":" prefix
1767 (,(getenv "GI_TYPELIB_PATH")))))))
1768 (add-before 'sanity-check 'set-home
1769 (lambda _
1770 (setenv "HOME" "/tmp"))))))
1771 (native-inputs
1772 (list intltool
1773 python-pytest
1774 python-setuptools))
1775 (inputs
1776 (list bash-minimal
1777 gtk+
1778 img2pdf
1779 poppler
1780 python-dateutil
1781 python-pikepdf
1782 python-pycairo
1783 python-pygobject-3.50))
1784 (home-page "https://github.com/pdfarranger/pdfarranger")
1785 (synopsis "Merge, split and re-arrange pages from PDF documents")
1786 (description
1787 "PDF Arranger is a small application which allows one to merge or split
1788PDF documents and rotate, crop and rearrange their pages using an interactive
1789and intuitive graphical interface.
1790
1791PDF Arranger was formerly known as PDF-Shuffler.")
1792 (license license:gpl3+)))
1793
1794(define-public pdfposter
1795 (package
1796 (name "pdfposter")
1797 (version "0.9.1")
1798 (source
1799 (origin
1800 (method url-fetch)
1801 (uri (pypi-uri "pdfposter" version))
1802 (sha256
1803 (base32 "0vhg43svzxr6ppcy888xg1hzjqfxbx5cc4qi77n4pvrqfan19633"))))
1804 (build-system pyproject-build-system)
1805 (arguments
1806 `(#:tests? #f)) ;test-suite not included in source archive
1807 (native-inputs (list python-setuptools python-wheel))
1808 (inputs (list python-pypdf))
1809 (home-page "https://pythonhosted.org/pdftools.pdfposter/")
1810 (synopsis "Scale and tile PDF images/pages to print on multiple pages")
1811 (description "@command{pdfposter} can be used to create a large poster by
1812building it from multiple pages and/or printing it on large media. It expects
1813as input a PDF file, normally printing on a single page. The output is again
1814a PDF file, maybe containing multiple pages together building the poster. The
1815input page will be scaled to obtain the desired size.
1816
1817This is much like @command{poster} does for Postscript files, but working with
1818PDF. Since sometimes @command{poster} does not like your files converted from
1819PDF. Indeed @command{pdfposter} was inspired by @command{poster}.")
1820 (license license:gpl3+)))
1821
1822(define-public pdfgrep
1823 (package
1824 (name "pdfgrep")
1825 (version "2.2.0")
1826 (source
1827 (origin
1828 (file-name (git-file-name name version))
1829 (method git-fetch)
1830 (sha256
1831 (base32 "0bykm8rbvd6g725gw0jas2ijq0w16pa657q6idp1yzgqcmjzmx98"))
1832 (uri (git-reference
1833 (url "https://gitlab.com/pdfgrep/pdfgrep.git")
1834 (commit (string-append "v" version))))))
1835 (build-system gnu-build-system)
1836 (arguments
1837 (list
1838 #:configure-flags
1839 ;; Install the built manpage and shell completions.
1840 #~(list "--enable-doc"
1841 ;; error: ‘malloc’ has not been declared in ‘::’
1842 ;; error: ‘realloc’ has not been declared in ‘::’
1843 #$@(if (%current-target-system)
1844 #~("ac_cv_func_malloc_0_nonnull=yes"
1845 "ac_cv_func_realloc_0_nonnull=yes")
1846 #~()))
1847 #:phases
1848 #~(modify-phases %standard-phases
1849 (add-after 'unpack 'fix-cpp-paths
1850 (lambda _
1851 (substitute* (list "src/search.h" "src/pdfgrep.cc"
1852 "src/search.cc")
1853 (("cpp\\/poppler") "poppler")))))))
1854 (native-inputs
1855 (list asciidoc ;bin/a2x builds doc/pdfgrep.1
1856 autoconf
1857 automake
1858 libgcrypt ;share/aclocal
1859 pkg-config))
1860 (inputs
1861 (list libgcrypt pcre poppler))
1862 (home-page "https://pdfgrep.org")
1863 (synopsis "Command-line utility to search text in PDF files")
1864 (description
1865 "Pdfgrep searches in PDF files for strings matching a regular
1866expression. It supports some GNU grep options such as: file name
1867output, page number output, optional case insensitivity, count
1868occurrences, color highlights and search in multiple files.")
1869 (license license:gpl2+)))
1870
1871(define-public pdfpc
1872 (package
1873 (name "pdfpc")
1874 (version "4.7.0")
1875 (source
1876 (origin
1877 (method git-fetch)
1878 (uri (git-reference
1879 (url "https://github.com/pdfpc/pdfpc")
1880 (commit (string-append "v" version))))
1881 (file-name (git-file-name name version))
1882 (sha256
1883 (base32 "1sx3ivnwyfr32hf1424aafpljhq5nm6pngl2zhvjsb24gnp45y3w"))))
1884 (build-system cmake-build-system)
1885 (arguments '(#:tests? #f)) ; no test target
1886 (inputs (list
1887 cairo
1888 discount ; libmarkdown
1889 qrencode
1890 gtk+
1891 gstreamer
1892 gst-plugins-base
1893 json-glib
1894 libgee
1895 poppler
1896 pango
1897 vala
1898 webkitgtk-for-gtk3))
1899 (native-inputs
1900 (list pkg-config))
1901 (home-page "https://pdfpc.github.io/")
1902 (synopsis "Presenter console with multi-monitor support for PDF files")
1903 (description
1904 "pdfpc is a presentation viewer application which uses multi-monitor
1905output to provide meta information to the speaker during the presentation. It
1906is able to show a normal presentation window on one screen, while showing a
1907more sophisticated overview on the other one providing information like a
1908picture of the next slide, as well as the left over time till the end of the
1909presentation. The input files processed by pdfpc are PDF documents.")
1910 (license license:gpl3+)))
1911
1912(define-public paps
1913 ;; Fails to build in latest release.
1914 (let ((commit "199b478ca3884df4c0786948aae09c7928c6498f")
1915 (revision "0"))
1916 (package
1917 (name "paps")
1918 (version (git-version "0.8.0" revision commit))
1919 (source
1920 (origin
1921 (method git-fetch)
1922 (uri (git-reference
1923 (url "https://github.com/dov/paps")
1924 (commit commit)))
1925 (file-name (git-file-name name version))
1926 (sha256
1927 (base32 "1p0sa36h98jkq54hzqax7c97cxvx0f2sslrvccp3f1m6sp5f165k"))))
1928 (build-system meson-build-system)
1929 (inputs
1930 (list libpaper pango))
1931 (native-inputs
1932 (list fmt gettext-minimal pkg-config))
1933 (home-page "https://github.com/dov/paps")
1934 (synopsis "Pango to PostScript converter")
1935 (description
1936 "Paps reads a UTF-8 encoded file and generates a PostScript language
1937rendering of the file through the Pango Cairo back end.")
1938 (license license:lgpl2.0+))))
1939
1940(define-public stapler
1941 (let ((commit "23eb07270dd3362a78064e721474b17951daeb88")
1942 (revision "0"))
1943 (package
1944 (name "stapler")
1945 (version (git-version "1.1.0" revision commit))
1946 (source
1947 (origin
1948 (method git-fetch)
1949 (uri (git-reference
1950 ;; It's an fixed fork of
1951 ;; <https://github.com/hellerbarde/stapler>.
1952 (url "https://github.com/cvnb/stapler")
1953 (commit commit)))
1954 (file-name (git-file-name name version))
1955 (sha256
1956 (base32
1957 "1ph385gax9jzfia69y5vac4lk371bhvc4mf5l2ka2026ihdq6wbj"))))
1958 (build-system pyproject-build-system)
1959 (arguments
1960 (list
1961 #:test-flags #~(list "staplelib/tests.py") ; from tox.ini
1962 #:build-backend "poetry.core.masonry.api"
1963 #:phases
1964 #~(modify-phases %standard-phases
1965 (add-after 'unpack 'fix-pypdf-version-requirement
1966 (lambda _
1967 (substitute* "pyproject.toml"
1968 (("pypdf = \"^4.2.0\"")
1969 "pypdf = \"^6.0.0\"")))))))
1970 (native-inputs (list python-poetry-core python-pytest))
1971 (propagated-inputs (list python-pypdf))
1972 (home-page "https://github.com/cvnb/stapler")
1973 (synopsis "PDF manipulation tool")
1974 (description
1975 "Stapler is a pure Python alternative to PDFtk, a tool for
1976manipulating PDF documents from the command line. It supports
1977
1978@itemize
1979@item cherry-picking pages and concatenating them into a new file
1980@item splitting a PDF document into single pages each in its own file
1981@item merging PDF documents with their pages interleaved
1982@item displaying metadata in a PDF document
1983@item displaying the mapping between logical and physical page numbers
1984@end itemize")
1985 (license license:bsd-3))))
1986
1987(define-public weasyprint
1988 (package
1989 (name "weasyprint")
1990 (version "68.1")
1991 (source
1992 (origin
1993 (method git-fetch)
1994 (uri (git-reference
1995 (url "https://github.com/Kozea/WeasyPrint")
1996 (commit (string-append "v" version))))
1997 (file-name (git-file-name name version))
1998 (sha256
1999 (base32
2000 "1gw91v7lyrhxlsjq2y16fp7219glwhni6zhabny74bd291l6x2n6"))))
2001 (build-system pyproject-build-system)
2002 (arguments
2003 (list
2004 ;; tests: 3813 passed, 40 xfailed
2005 #:test-flags
2006 #~(list "--numprocesses" (number->string (min 8 (parallel-job-count)))
2007 #$@(map (lambda (ls) (string-append "--deselect=tests/"
2008 (string-join ls "::")))
2009 ;; ValueError: too many values to unpack (expected 2)
2010 '(("test_acid2.py" "test_acid2")
2011 ("test_presentational_hints.py" "test_no_ph")
2012 ("test_presentational_hints.py" "test_ph_page")
2013 ("test_presentational_hints.py" "test_ph_flow")
2014 ("test_presentational_hints.py" "test_ph_phrasing")
2015 ("test_presentational_hints.py" "test_ph_lists")
2016 ("test_presentational_hints.py" "test_ph_lists_types")
2017 ("test_presentational_hints.py" "test_ph_tables")
2018 ("test_presentational_hints.py" "test_ph_hr")
2019 ("test_presentational_hints.py" "test_ph_embedded")
2020 ;; assert 793.7007874015749 == 10
2021 ("css/test_nesting.py" "test_nesting_block")
2022 ;; AssertionError: <...> errors logged.
2023 ("css/test_ua.py""test_ua_stylesheets")
2024 ;; AssertionError: Images do not have the same sizes.
2025 ("draw/test_footnote.py" "test_footnote_max_height_2")
2026 ("draw/test_footnote.py" "test_footnote_max_height_3")
2027 ;; Failed: Pixel <...> in <...>.
2028 ("draw/svg/test_opacity.py"
2029 "test_pattern_gradient_stroke_fill_opacity")
2030 ("draw/test_footnote.py" "test_footnote_max_height_1")
2031 ("draw/test_footnote.py" "test_footnote_max_height_4")
2032 ("draw/test_footnote.py" "test_footnote_max_height_5")
2033 ("draw/test_gradient.py" "test_linear_gradients_5")
2034 ("draw/test_gradient.py" "test_linear_gradients_12")
2035 ("draw/test_gradient.py"
2036 "test_radial_gradients_repeating")
2037 ("draw/test_gradient.py"
2038 "test_radial_gradients_repeating_outer")
2039 ("draw/test_gradient.py"
2040 "test_radial_gradients_repeating_outer_partial")
2041 ("draw/test_gradient.py"
2042 "test_radial_gradients_repeating_negative"))))
2043 #:phases
2044 #~(modify-phases %standard-phases
2045 (add-after 'unpack 'patch-library-paths
2046 (lambda* (#:key inputs #:allow-other-keys)
2047 (substitute* "weasyprint/text/ffi.py"
2048 (("'gobject-2.0-0'")
2049 (format #f "~s"
2050 (search-input-file inputs "lib/libgobject-2.0.so")))
2051 (("'pango-1.0-0'")
2052 (format #f "~s"
2053 (search-input-file inputs "lib/libpango-1.0.so")))
2054 (("'harfbuzz'")
2055 (format #f "~s"
2056 (search-input-file inputs "lib/libharfbuzz.so")))
2057 (("'fontconfig-1'")
2058 (format #f "~s"
2059 (search-input-file inputs "lib/libfontconfig.so")))
2060 (("'pangoft2-1.0-0'")
2061 (format #f "~s"
2062 (search-input-file inputs
2063 "lib/libpangoft2-1.0.so"))))))
2064 (add-before 'sanity-check 'set-home
2065 (lambda _
2066 (setenv "HOME" "/tmp"))))))
2067 (inputs (list fontconfig glib harfbuzz pango))
2068 (propagated-inputs
2069 (list gdk-pixbuf
2070 python-cffi
2071 python-cssselect2
2072 python-fonttools
2073 python-pillow
2074 python-pydyf
2075 python-pyphen
2076 python-tinycss2
2077 python-tinyhtml5))
2078 (native-inputs
2079 (list font-dejavu ;tests depend on it
2080 ghostscript
2081 python-flit-core
2082 python-pytest
2083 python-pytest-xdist))
2084 (home-page "https://weasyprint.org/")
2085 (synopsis "Document factory for creating PDF files from HTML")
2086 (description "WeasyPrint helps web developers to create PDF documents. It
2087turns simple HTML pages into gorgeous statistical reports, invoices, tickets,
2088etc.
2089
2090From a technical point of view, WeasyPrint is a visual rendering engine for
2091HTML and CSS that can export to PDF and PNG. It aims to support web standards
2092for printing.
2093
2094It is based on various libraries but not on a full rendering engine like
2095WebKit or Gecko. The CSS layout engine is written in Python, designed for
2096pagination, and meant to be easy to hack on. Weasyprint can also be used as a
2097python library.
2098
2099Keywords: html2pdf, htmltopdf")
2100 (license license:bsd-3)))
2101
2102(define-public sioyek
2103 (let ((commit "8d173d993738d78559da035cc051f2eb40df41e6")
2104 (revision "1"))
2105 (package
2106 (name "sioyek")
2107 (version (git-version "2.0.0" revision commit))
2108 (source
2109 (origin
2110 (method git-fetch)
2111 (uri (git-reference
2112 (url "https://github.com/ahrm/sioyek")
2113 (commit commit)))
2114 (file-name (git-file-name name version))
2115 (sha256
2116 (base32 "10d08ajcm5ckvrj5xkgi0dj9ibndi961v2yacw7a8mxkdqki6ck6"))
2117 (modules '((guix build utils)))
2118 ;; libmupdf-third.so no longer available since mupdf 1.18.0.
2119 (snippet '(substitute* "pdf_viewer_build_config.pro"
2120 (("-lmupdf-third") "")))))
2121 (build-system cmake-build-system)
2122 (arguments
2123 (list
2124 #:tests? #f ; no tests
2125 #:configure-flags
2126 #~(list (string-append "PREFIX=" #$output))
2127 #:modules '((guix build cmake-build-system)
2128 ((guix build gnu-build-system) #:prefix gnu:)
2129 (guix build utils))
2130 #:phases
2131 #~(modify-phases %standard-phases
2132 (add-after 'unpack 'patch-paths
2133 (lambda _
2134 (substitute* "pdf_viewer/main.cpp"
2135 (("/usr/share")
2136 (string-append #$output "/share"))
2137 (("/etc")
2138 (string-append #$output "/etc")))))
2139 (replace 'configure
2140 (lambda* (#:key configure-flags #:allow-other-keys)
2141 (apply invoke "qmake" configure-flags)))
2142 (replace 'build (assoc-ref gnu:%standard-phases 'build))
2143 (replace 'install (assoc-ref gnu:%standard-phases 'install))
2144 (add-after 'install 'install-man-page
2145 (lambda _
2146 (install-file "resources/sioyek.1"
2147 (string-append #$output "/share/man/man1")))))))
2148 (inputs
2149 (list freetype
2150 gumbo-parser
2151 harfbuzz
2152 jbig2dec
2153 libjpeg-turbo
2154 mujs
2155 mupdf
2156 openjpeg
2157 qtbase
2158 qtdeclarative
2159 qtsvg
2160 qt3d
2161 qtspeech
2162 qtwayland
2163 zlib))
2164 (home-page "https://sioyek.info/")
2165 (synopsis "PDF viewer with a focus on technical books and research papers")
2166 (description
2167 "Sioyek is a PDF viewer with a focus on textbooks and research papers.")
2168 (license license:gpl3+))))
2169
2170(define-public pdftk
2171 (package
2172 (name "pdftk")
2173 (version "3.3.3")
2174 (source
2175 (origin
2176 (method url-fetch)
2177 (uri (string-append "https://gitlab.com/pdftk-java/pdftk/-/archive/v"
2178 version "/pdftk-v" version ".tar.gz"))
2179 (sha256
2180 (base32 "11mj0phf78pkbdzvnfhl7n4z476fiv1zjfbf2cx9wlsq8vjpv54w"))))
2181 (build-system ant-build-system)
2182 (arguments
2183 (list
2184 #:jdk openjdk11
2185 #:tests? #f ; no test suite
2186 #:phases
2187 #~(modify-phases %standard-phases
2188 (add-before 'build 'copy-lib-files
2189 (lambda* (#:key inputs #:allow-other-keys)
2190 (mkdir-p "lib")
2191 (for-each
2192 (lambda (lib)
2193 (copy-file lib (string-append "lib/" (basename lib))))
2194 (append
2195 (find-files (assoc-ref inputs "java-bouncycastle") "\\.jar$")
2196 (find-files (assoc-ref inputs "java-commons-lang3") "\\.jar$")))))
2197 (replace 'install
2198 (lambda* (#:key inputs outputs #:allow-other-keys)
2199 (let* ((out (assoc-ref outputs "out"))
2200 (bin (string-append out "/bin"))
2201 (share (string-append out "/share"))
2202 (lib (string-append out "/lib"))
2203 (doc (string-append share "/doc/pdftk"))
2204 (man1 (string-append share "/man/man1")))
2205 (mkdir-p bin)
2206 (mkdir-p lib)
2207 (mkdir-p doc)
2208 (mkdir-p man1)
2209 (install-file "build/jar/pdftk.jar" lib)
2210 ;; Install dependencies.
2211 (for-each
2212 (lambda (dep-jar)
2213 (symlink dep-jar
2214 (string-append lib "/" (basename dep-jar))))
2215 (append
2216 (find-files (assoc-ref inputs "java-bouncycastle") "\\.jar$")
2217 (find-files (assoc-ref inputs "java-commons-lang3") "\\.jar$")))
2218 ;; Create wrapper script.
2219 (with-output-to-file (string-append bin "/pdftk")
2220 (lambda _
2221 (format #t
2222 "#!~a/bin/bash~@
2223 CLASSPATH=~a/lib/pdftk.jar:~a/lib/*~@
2224 exec ~a/bin/java -cp $CLASSPATH com.gitlab.pdftk_java.pdftk \"$@\"~%"
2225 (assoc-ref inputs "bash")
2226 out
2227 out
2228 (assoc-ref inputs "openjdk"))))
2229 ;; Make the wrapper executable.
2230 (chmod (string-append bin "/pdftk") #o755)
2231 (copy-recursively "doc" doc)
2232 (install-file "pdftk.1" man1)))))))
2233 (inputs
2234 (list bash java-bouncycastle java-commons-lang3 openjdk11))
2235 (home-page "https://gitlab.com/pdftk-java/pdftk")
2236 (synopsis "Tool for manipulating PDF documents")
2237 (description
2238 "This package provides a tool for doing everyday things with PDF
2239documents. It can:
2240@itemize
2241@item Merge PDF documents or collate PDF page scans
2242@item Split PDF pages into a new document
2243@item Rotate PDF documents or pages
2244@item Decrypt input as necessary (password required)
2245@item Encrypt output as desired
2246@item Fill PDF forms with X/FDF data and/or flatten forms
2247@item Generate FDF data stencils from PDF forms
2248@item Apply a background watermark or a foreground stamp
2249@item Report PDF metrics, bookmarks and metadata
2250@item Add/Update PDF bookmarks or metadata
2251@item Attach files to PDF pages or the PDF document
2252@item Unpack PDF attachments
2253@item Burst a PDF document into single pages
2254@item Uncompress and re-compress page streams
2255@item Repair corrupted PDF (where possible)
2256@end itemize")
2257 (license license:gpl2+)))