projects/guix·blob ruby-team · refs

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