de4ad2582a355dd7dbad3bae7ffaeb8105c088ed
[jackhill/guix/guix.git] / gnu / packages / pdf.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2015, 2016 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2014, 2015, 2016, 2018, 2019, 2021 Ricardo Wurmus <rekado@elephly.net>
5 ;;; Copyright © 2015 Paul van der Walt <paul@denknerd.org>
6 ;;; Copyright © 2016 Roel Janssen <roel@gnu.org>
7 ;;; Copyright © 2016 Nikita <nikita@n0.is>
8 ;;; Copyright © 2016, 2017, 2018, 2019, 2020 Efraim Flashner <efraim@flashner.co.il>
9 ;;; Copyright © 2016, 2017 Marius Bakke <mbakke@fastmail.com>
10 ;;; Copyright © 2016, 2017, 2019 Ludovic Courtès <ludo@gnu.org>
11 ;;; Copyright © 2016 Julien Lepiller <julien@lepiller.eu>
12 ;;; Copyright © 2016, 2019 Arun Isaac <arunisaac@systemreboot.net>
13 ;;; Copyright © 2017, 2018 Leo Famulari <leo@famulari.name>
14 ;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com>
15 ;;; Copyright © 2017, 2018 Rene Saavedra <pacoon@protonmail.com>
16 ;;; Copyright © 2017–2021 Tobias Geerinckx-Rice <me@tobias.gr>
17 ;;; Copyright © 2019 Alex Griffin <a@ajgrf.com>
18 ;;; Copyright © 2019 Ben Sturmfels <ben@sturm.com.au>
19 ;;; Copyright © 2019,2020 Hartmut Goebel <h.goebel@crazy-compilers.com>
20 ;;; Copyright © 2020, 2021 Nicolas Goaziou <mail@nicolasgoaziou.fr>
21 ;;; Copyright © 2020 Michael Rohleder <mike@rohleder.de>
22 ;;; Copyright © 2020 Timotej Lazar <timotej.lazar@araneo.si>
23 ;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
24 ;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
25 ;;;
26 ;;; This file is part of GNU Guix.
27 ;;;
28 ;;; GNU Guix is free software; you can redistribute it and/or modify it
29 ;;; under the terms of the GNU General Public License as published by
30 ;;; the Free Software Foundation; either version 3 of the License, or (at
31 ;;; your option) any later version.
32 ;;;
33 ;;; GNU Guix is distributed in the hope that it will be useful, but
34 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
35 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36 ;;; GNU General Public License for more details.
37 ;;;
38 ;;; You should have received a copy of the GNU General Public License
39 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
40
41 (define-module (gnu packages pdf)
42 #:use-module ((guix licenses) #:prefix license:)
43 #:use-module (guix packages)
44 #:use-module (guix download)
45 #:use-module (guix git-download)
46 #:use-module (guix utils)
47 #:use-module (guix build-system gnu)
48 #:use-module (guix build-system cmake)
49 #:use-module (guix build-system meson)
50 #:use-module (guix build-system python)
51 #:use-module (guix build-system qt)
52 #:use-module (guix build-system trivial)
53 #:use-module (gnu packages)
54 #:use-module (gnu packages audio)
55 #:use-module (gnu packages autotools)
56 #:use-module (gnu packages backup)
57 #:use-module (gnu packages base)
58 #:use-module (gnu packages bash)
59 #:use-module (gnu packages build-tools)
60 #:use-module (gnu packages check)
61 #:use-module (gnu packages compression)
62 #:use-module (gnu packages cups)
63 #:use-module (gnu packages curl)
64 #:use-module (gnu packages djvu)
65 #:use-module (gnu packages fonts)
66 #:use-module (gnu packages fontutils)
67 #:use-module (gnu packages game-development)
68 #:use-module (gnu packages gettext)
69 #:use-module (gnu packages ghostscript)
70 #:use-module (gnu packages gl)
71 #:use-module (gnu packages glib)
72 #:use-module (gnu packages gnome)
73 #:use-module (gnu packages gnupg)
74 #:use-module (gnu packages gstreamer)
75 #:use-module (gnu packages gtk)
76 #:use-module (gnu packages image)
77 #:use-module (gnu packages javascript)
78 #:use-module (gnu packages lesstif)
79 #:use-module (gnu packages libffi)
80 #:use-module (gnu packages linux)
81 #:use-module (gnu packages lua)
82 #:use-module (gnu packages man)
83 #:use-module (gnu packages markup)
84 #:use-module (gnu packages pcre)
85 #:use-module (gnu packages perl)
86 #:use-module (gnu packages photo)
87 #:use-module (gnu packages pkg-config)
88 #:use-module (gnu packages pulseaudio)
89 #:use-module (gnu packages python)
90 #:use-module (gnu packages python-check)
91 #:use-module (gnu packages python-web)
92 #:use-module (gnu packages python-xyz)
93 #:use-module (gnu packages qt)
94 #:use-module (gnu packages sdl)
95 #:use-module (gnu packages sphinx)
96 #:use-module (gnu packages sqlite)
97 #:use-module (gnu packages tex)
98 #:use-module (gnu packages time)
99 #:use-module (gnu packages tcl)
100 #:use-module (gnu packages tls)
101 #:use-module (gnu packages web)
102 #:use-module (gnu packages webkit)
103 #:use-module (gnu packages xdisorg)
104 #:use-module (gnu packages xml)
105 #:use-module (gnu packages xorg)
106 #:use-module (srfi srfi-1))
107
108 (define-public extractpdfmark
109 (package
110 (name "extractpdfmark")
111 (version "1.1.0")
112 (source
113 (origin
114 (method git-fetch)
115 (uri (git-reference
116 (url "https://github.com/trueroad/extractpdfmark")
117 (commit (string-append "v" version))))
118 (file-name (git-file-name name version))
119 (sha256
120 (base32 "14aa6zly53j8gx5d32caiabk2j4b102xha0v9149yahz6kbn5b80"))))
121 (build-system gnu-build-system)
122 (arguments
123 `(#:phases
124 (modify-phases %standard-phases
125 (add-before 'check 'start-xorg-server
126 ;; The test suite wants to write to /homeless-shelter
127 (lambda _ (setenv "HOME" (getcwd)))))))
128 (native-inputs
129 `(("autoconf" ,autoconf)
130 ("automake" ,automake)
131 ("gettext" ,gettext-minimal)
132 ("ghostscript" ,ghostscript)
133 ("pkg-config" ,pkg-config)
134 ("texlive" ,texlive-tiny)))
135 (inputs
136 (list poppler))
137 (home-page "https://github.com/trueroad/extractpdfmark")
138 (synopsis "Extract page mode and named destinations as PDFmark from PDF")
139 (description
140 "PDFmarks is a technique that accompanies PDF, and that is used to store
141 metadata such as author or title, but also structural information such as
142 bookmarks or hyperlinks.
143
144 When Ghostscript reads the main PDF generated by the TeX system with embedded
145 PDF files and outputs the final PDF, the PDF page mode and name targets
146 etc. are not preserved. Therefore, when you open the final PDF, it is not
147 displayed correctly. Also, remote PDF links do not work correctly.
148
149 This program is able to extract the page mode and named targets as PDFmark
150 from PDF. In this way, you can obtain embedded PDF files that have kept this
151 information.")
152 (license license:gpl3)))
153
154 (define-public flyer-composer
155 (package
156 (name "flyer-composer")
157 (version "1.0rc2")
158 (source
159 (origin
160 (method url-fetch)
161 (uri (pypi-uri "flyer-composer" version))
162 (sha256
163 (base32 "17igqb5dlcgcq4nimjw6cf9qgz6a728zdx1d0rr90r2z0llcchsv"))))
164 (build-system python-build-system)
165 (arguments
166 `(#:tests? #f ;; TODO
167 #:phases
168 (modify-phases %standard-phases
169 (add-after 'install 'wrap-executable
170 (lambda* (#:key inputs outputs #:allow-other-keys)
171 (let* ((out (assoc-ref outputs "out"))
172 (qtbase (assoc-ref inputs "qtbase"))
173 (qml "/lib/qt5/qml"))
174 (wrap-program (string-append out "/bin/flyer-composer-gui")
175 `("QT_PLUGIN_PATH" ":" =
176 (,(string-append qtbase "/lib/qt5/plugins")))
177 `("QT_QPA_PLATFORM_PLUGIN_PATH" ":" =
178 (,(string-append qtbase "/lib/qt5/plugins/platforms"))))
179 #t))))))
180 (inputs
181 (list python-pypdf2 python-pyqt python-poppler-qt5 qtbase-5))
182 (home-page "http://crazy-compilers.com/flyer-composer")
183 (synopsis "Rearrange PDF pages to print as flyers on one sheet")
184 (description "@command{flyer-composer} can be used to prepare one- or
185 two-sided flyers for printing on one sheet of paper.
186
187 Imagine you have designed a flyer in A6 format and want to print it using your
188 A4 printer. Of course, you want to print four flyers on each sheet. This is
189 where Flyer Composer steps in, creating a PDF which holds your flyer four
190 times. If you have a second page, Flyer Composer can arrange it the same way
191 - even if the second page is in a separate PDF file.
192
193 This package contains both the command line tool and the gui too.")
194 (license license:agpl3+)))
195
196 (define-public flyer-composer-cli
197 (package/inherit flyer-composer
198 (name "flyer-composer-cli")
199 (arguments
200 `(#:tests? #f ;; TODO
201 #:phases
202 (modify-phases %standard-phases
203 (add-after 'unpack 'remove-gui
204 (lambda _
205 (delete-file-recursively "flyer_composer/gui")
206 (substitute* "setup.cfg"
207 (("^\\s+flyer-composer-gui\\s*=.*") ""))
208 #t)))))
209 (inputs
210 `(("python-pypdf2" ,python-pypdf2)))
211 (description "@command{flyer-composer} can be used to prepare one- or
212 two-sided flyers for printing on one sheet of paper.
213
214 Imagine you have designed a flyer in A6 format and want to print it using your
215 A4 printer. Of course, you want to print four flyers on each sheet. This is
216 where Flyer Composer steps in, creating a PDF which holds your flyer four
217 times. If you have a second page, Flyer Composer can arrange it the same way
218 - even if the second page is in a separate PDF file.
219
220 This package contains only the command line tool. If you like to use the gui,
221 please install the @code{flyer-composer-gui} package.")))
222
223 (define-public poppler
224 (package
225 (name "poppler")
226 (version "21.07.0")
227 (source (origin
228 (method url-fetch)
229 (uri (string-append "https://poppler.freedesktop.org/poppler-"
230 version ".tar.xz"))
231 (sha256
232 (base32
233 "1m54hsi8z6c13jdbjwz55flkra1mahmkw2igavbf8p86d2gv4sp2"))))
234 (build-system cmake-build-system)
235 ;; FIXME:
236 ;; use libcurl: no
237 (inputs `(("fontconfig" ,fontconfig)
238 ("freetype" ,freetype)
239 ("libjpeg" ,libjpeg-turbo)
240 ("libpng" ,libpng)
241 ("libtiff" ,libtiff)
242 ("lcms" ,lcms)
243 ("openjpeg" ,openjpeg)
244 ("zlib" ,zlib)
245
246 ;; To build poppler-glib (as needed by Evince), we need Cairo and
247 ;; GLib. But of course, that Cairo must not depend on Poppler.
248 ("cairo" ,cairo-sans-poppler)))
249 (propagated-inputs
250 ;; As per poppler-cairo and poppler-glib.pc.
251 ;; XXX: Ideally we'd propagate Cairo too, but that would require a
252 ;; different solution to the circular dependency mentioned above.
253 (list glib))
254 (native-inputs
255 (list pkg-config
256 `(,glib "bin") ; glib-mkenums, etc.
257 gobject-introspection))
258 (arguments
259 `(#:tests? #f ;no test data provided with the tarball
260 #:configure-flags
261 (let* ((out (assoc-ref %outputs "out"))
262 (lib (string-append out "/lib")))
263 (list "-DENABLE_UNSTABLE_API_ABI_HEADERS=ON" ;to install header files
264 "-DENABLE_ZLIB=ON"
265 "-DENABLE_BOOST=OFF" ;disable Boost to save size
266 (string-append "-DCMAKE_INSTALL_LIBDIR=" lib)
267 (string-append "-DCMAKE_INSTALL_RPATH=" lib)))
268 ,@(if (%current-target-system)
269 `(#:phases
270 (modify-phases %standard-phases
271 (add-after 'unpack 'set-PKG_CONFIG
272 (lambda _
273 (setenv "PKG_CONFIG" ,(pkg-config-for-target))))))
274 '())))
275 (synopsis "PDF rendering library")
276 (description
277 "Poppler is a PDF rendering library based on the xpdf-3.0 code base.")
278 (license license:gpl2+)
279 (home-page "https://poppler.freedesktop.org/")))
280
281 (define-public poppler-data
282 (package
283 (name "poppler-data")
284 (version "0.4.11")
285 (source (origin
286 (method url-fetch)
287 (uri (string-append "https://poppler.freedesktop.org/poppler-data"
288 "-" version ".tar.gz"))
289 (sha256
290 (base32
291 "137h4m48gc4v0srnr0gkwaqna6kfdqpy5886if5gjfmh3g6hbv1c"))))
292 (build-system gnu-build-system)
293 (arguments
294 '(#:tests? #f ; no test suite
295 #:make-flags (list (string-append "prefix=" (assoc-ref %outputs "out")))
296 #:phases
297 (modify-phases %standard-phases
298 ;; The package only provides some data files, so there is nothing to
299 ;; build.
300 (delete 'configure)
301 (delete 'build))))
302 (synopsis "Poppler encoding files for rendering of CJK and Cyrillic text")
303 (description "This package provides optional encoding files for Poppler.
304 When present, Poppler is able to correctly render CJK and Cyrillic text.")
305 (home-page (package-home-page poppler))
306 ;; See COPYING in the source distribution for more information about
307 ;; the licensing.
308 (license (list license:bsd-3
309 license:gpl2))))
310
311 (define-public poppler-qt5
312 (package/inherit poppler
313 (name "poppler-qt5")
314 (inputs `(("qtbase" ,qtbase-5)
315 ,@(package-inputs poppler)))
316 (synopsis "Qt5 frontend for the Poppler PDF rendering library")))
317
318 (define-public python-poppler-qt5
319 (package
320 (name "python-poppler-qt5")
321 (version "21.1.0")
322 (source
323 (origin
324 (method url-fetch)
325 (uri (pypi-uri "python-poppler-qt5" version))
326 (sha256
327 (base32
328 "0b82gm4i75q5v19kfbq0h4y0b2vcwr2213zkhxh6l0h45kdndmxd"))
329 (patches (search-patches "python-poppler-qt5-fix-build.patch"))))
330 (build-system python-build-system)
331 (arguments
332 `(;; There are no tests. The check phase just causes a rebuild.
333 #:tests? #f
334 #:phases
335 (modify-phases %standard-phases
336 (replace 'build
337 (lambda* (#:key inputs #:allow-other-keys)
338 (substitute* "setup.py"
339 ;; This check always fails, so disable it.
340 (("if not check_qtxml\\(\\)")
341 "if True"))
342 ;; We need to pass an extra flag here. This cannot be in
343 ;; configure-flags because it should not be passed for the
344 ;; installation phase.
345 ((@@ (guix build python-build-system) call-setuppy)
346 "build_ext" (list (string-append "--pyqt-sip-dir="
347 (assoc-ref inputs "python-pyqt")
348 "/share/sip")) #t))))))
349 (native-inputs
350 (list pkg-config))
351 (inputs
352 (list python-sip-4 python-pyqt poppler-qt5 qtbase-5))
353 (home-page "https://pypi.org/project/python-poppler-qt5/")
354 (synopsis "Python bindings for Poppler-Qt5")
355 (description
356 "This package provides Python bindings for the Qt5 interface of the
357 Poppler PDF rendering library.")
358 (license license:lgpl2.1+)))
359
360 (define-public libharu
361 (package
362 (name "libharu")
363 (version "2.3.0")
364 (source (origin
365 (method git-fetch)
366 (uri (git-reference
367 (url "https://github.com/libharu/libharu")
368 (commit (string-append
369 "RELEASE_"
370 (string-join (string-split version #\.) "_")))))
371 (file-name (git-file-name name version))
372 (sha256
373 (base32
374 "15s9hswnl3qqi7yh29jyrg0hma2n99haxznvcywmsp8kjqlyg75q"))))
375 (build-system gnu-build-system)
376 (arguments
377 `(#:configure-flags
378 (list (string-append "--with-zlib="
379 (assoc-ref %build-inputs "zlib"))
380 (string-append "--with-png="
381 (assoc-ref %build-inputs "libpng")))))
382 (inputs
383 (list zlib libpng))
384 (native-inputs
385 (list autoconf automake libtool))
386 (home-page "http://libharu.org/")
387 (synopsis "Library for generating PDF files")
388 (description
389 "libHaru is a library for generating PDF files. libHaru does not support
390 reading and editing of existing PDF files.")
391 (license license:zlib)))
392
393 (define-public xpdf
394 (package
395 (name "xpdf")
396 (version "4.03")
397 (source
398 (origin
399 (method url-fetch)
400 (uri (string-append "https://dl.xpdfreader.com/xpdf-" version ".tar.gz"))
401 (sha256
402 (base32 "0ip81c9vy0igjnasl9iv2lz214fb01vvvdzbvjmgwc63fi1jgr0g"))))
403 (build-system cmake-build-system)
404 (inputs (list cups freetype libpng qtbase-5 zlib))
405 (arguments
406 `(#:tests? #f)) ; there is no check target
407 (synopsis "Viewer for PDF files based on the Motif toolkit")
408 (description
409 "Xpdf is a viewer for Portable Document Format (PDF) files.")
410 (license license:gpl3) ; or gpl2, but not gpl2+
411 (home-page "https://www.xpdfreader.com/")))
412
413 (define-public zathura-cb
414 (package
415 (name "zathura-cb")
416 (version "0.1.8")
417 (source (origin
418 (method url-fetch)
419 (uri
420 (string-append "https://pwmt.org/projects/zathura-cb/download/zathura-cb-"
421 version ".tar.xz"))
422 (sha256
423 (base32
424 "1i6cf0vks501cggwvfsl6qb7mdaf3sszdymphimfvnspw810faj5"))))
425 (native-inputs (list pkg-config))
426 (inputs (list libarchive zathura))
427 (build-system meson-build-system)
428 (arguments
429 `(#:tests? #f ; package does not contain tests
430 #:phases
431 (modify-phases %standard-phases
432 (add-after 'unpack 'patch-plugin-directory
433 ;; Something of a regression in 0.1.8: the new Meson build system
434 ;; now hard-codes an incorrect plugin directory. Fix it.
435 (lambda* (#:key outputs #:allow-other-keys)
436 (substitute* "meson.build"
437 (("(install_dir:).*" _ key)
438 (string-append key
439 "'" (assoc-ref outputs "out") "/lib/zathura'\n")))
440 #t)))))
441 (home-page "https://pwmt.org/projects/zathura-cb/")
442 (synopsis "Comic book support for zathura (libarchive backend)")
443 (description "The zathura-cb plugin adds comic book support to zathura
444 using libarchive.")
445 (license license:zlib)))
446
447 (define-public zathura-ps
448 (package
449 (name "zathura-ps")
450 (version "0.2.6")
451 (source (origin
452 (method url-fetch)
453 (uri
454 (string-append "https://pwmt.org/projects/zathura-ps/download/zathura-ps-"
455 version ".tar.xz"))
456 (sha256
457 (base32
458 "0wygq89nyjrjnsq7vbpidqdsirjm6iq4w2rijzwpk2f83ys8bc3y"))))
459 (native-inputs (list pkg-config))
460 (inputs (list libspectre zathura))
461 (build-system meson-build-system)
462 (arguments
463 `(#:tests? #f ; package does not contain tests
464 #:phases
465 (modify-phases %standard-phases
466 (add-after 'unpack 'patch-plugin-directory
467 ;; Something of a regression in 0.2.6: the new Meson build system
468 ;; now hard-codes an incorrect plugin directory. Fix it.
469 (lambda* (#:key outputs #:allow-other-keys)
470 (substitute* "meson.build"
471 (("(install_dir:).*" _ key)
472 (string-append key
473 "'" (assoc-ref outputs "out") "/lib/zathura'\n")))
474 #t)))))
475 (home-page "https://pwmt.org/projects/zathura-ps/")
476 (synopsis "PS support for zathura (libspectre backend)")
477 (description "The zathura-ps plugin adds PS support to zathura
478 using libspectre.")
479 (license license:zlib)))
480
481 (define-public zathura-djvu
482 (package
483 (name "zathura-djvu")
484 (version "0.2.9")
485 (source (origin
486 (method url-fetch)
487 (uri
488 (string-append "https://pwmt.org/projects/zathura-djvu/download/zathura-djvu-"
489 version ".tar.xz"))
490 (sha256
491 (base32
492 "0062n236414db7q7pnn3ccg5111ghxj3407pn9ri08skxskgirln"))))
493 (native-inputs (list pkg-config))
494 (inputs
495 (list djvulibre zathura))
496 (build-system meson-build-system)
497 (arguments
498 `(#:tests? #f ; package does not contain tests
499 #:phases
500 (modify-phases %standard-phases
501 (add-after 'unpack 'patch-plugin-directory
502 ;; Something of a regression in 0.2.8: the new Meson build system
503 ;; now hard-codes an incorrect plugin directory. Fix it.
504 (lambda* (#:key outputs #:allow-other-keys)
505 (substitute* "meson.build"
506 (("(install_dir:).*" _ key)
507 (string-append key
508 "'" (assoc-ref outputs "out") "/lib/zathura'\n")))
509 #t)))))
510 (home-page "https://pwmt.org/projects/zathura-djvu/")
511 (synopsis "DjVu support for zathura (DjVuLibre backend)")
512 (description "The zathura-djvu plugin adds DjVu support to zathura
513 using the DjVuLibre library.")
514 (license license:zlib)))
515
516 (define-public zathura-pdf-mupdf
517 (package
518 (name "zathura-pdf-mupdf")
519 (version "0.3.6")
520 (source (origin
521 (method url-fetch)
522 (uri
523 (string-append "https://pwmt.org/projects/zathura-pdf-mupdf"
524 "/download/zathura-pdf-mupdf-" version ".tar.xz"))
525 (sha256
526 (base32
527 "1r3v37k9fl2rxipvacgxr36llywvy7n20a25h3ajlyk70697sa66"))))
528 (native-inputs (list pkg-config))
529 (inputs
530 `(("jbig2dec" ,jbig2dec)
531 ("libjpeg" ,libjpeg-turbo)
532 ("mujs" ,mujs)
533 ("mupdf" ,mupdf)
534 ("openjpeg" ,openjpeg)
535 ("openssl" ,openssl)
536 ("zathura" ,zathura)))
537 (build-system meson-build-system)
538 (arguments
539 `(#:tests? #f ; package does not contain tests
540 #:configure-flags (list (string-append "-Dplugindir="
541 (assoc-ref %outputs "out")
542 "/lib/zathura")
543 "-Dlink-external=true")
544 #:phases
545 (modify-phases %standard-phases
546 (add-after 'unpack 'remove-libmupdfthird.a-requirement
547 (lambda _
548 ;; Ignore a missing (apparently superfluous) static library.
549 (substitute* "meson.build"
550 ((".*mupdfthird.*") ""))
551 #t))
552 (add-before 'configure 'add-mujs-to-dependencies
553 (lambda _
554 ;; Add mujs to the 'build_dependencies'.
555 (substitute* "meson.build"
556 (("^ libopenjp2 = dependency.*" x)
557 (string-append x " mujs = cc.find_library('mujs')\n"))
558 (("^ libopenjp2")
559 " libopenjp2, mujs")))))))
560 (home-page "https://pwmt.org/projects/zathura-pdf-mupdf/")
561 (synopsis "PDF support for zathura (mupdf backend)")
562 (description "The zathura-pdf-mupdf plugin adds PDF support to zathura
563 by using the @code{mupdf} rendering library.")
564 (license license:zlib)))
565
566 (define-public zathura-pdf-poppler
567 (package
568 (name "zathura-pdf-poppler")
569 (version "0.3.0")
570 (source (origin
571 (method url-fetch)
572 (uri
573 (string-append "https://pwmt.org/projects/zathura-pdf-poppler/download/zathura-pdf-poppler-"
574 version ".tar.xz"))
575 (sha256
576 (base32
577 "1vfl4vkyy3rf39r1sqaa7y8113bgkh2bkfq3nn2inis9mrykmk6m"))))
578 (native-inputs (list pkg-config))
579 (inputs
580 (list poppler zathura))
581 (build-system meson-build-system)
582 (arguments
583 `(#:tests? #f ; package does not include tests
584 #:phases
585 (modify-phases %standard-phases
586 (add-after 'unpack 'patch-plugin-directory
587 ;; Something of a regression in 0.2.9: the new Meson build system
588 ;; now hard-codes an incorrect plugin directory. Fix it.
589 (lambda* (#:key outputs #:allow-other-keys)
590 (substitute* "meson.build"
591 (("(install_dir:).*" _ key)
592 (string-append key
593 "'" (assoc-ref outputs "out") "/lib/zathura'\n")))
594 #t)))))
595 (home-page "https://pwmt.org/projects/zathura-pdf-poppler/")
596 (synopsis "PDF support for zathura (poppler backend)")
597 (description "The zathura-pdf-poppler plugin adds PDF support to zathura
598 by using the poppler rendering engine.")
599 (license license:zlib)))
600
601 (define-public zathura
602 (package
603 (name "zathura")
604 (version "0.4.8")
605 (source (origin
606 (method url-fetch)
607 (uri
608 (string-append "https://pwmt.org/projects/zathura/download/zathura-"
609 version ".tar.xz"))
610 (sha256
611 (base32
612 "1nr0ym1mi2afk4ycdf1ppmkcv7i7hyzwn4p3r4m0j2qm3nvaiami"))))
613 (native-inputs `(("pkg-config" ,pkg-config)
614 ("gettext" ,gettext-minimal)
615 ("glib:bin" ,glib "bin")
616
617 ;; For building documentation.
618 ("python-sphinx" ,python-sphinx)
619
620 ;; For building icons.
621 ("librsvg" ,librsvg)
622
623 ;; For tests.
624 ("check" ,check)
625 ("xorg-server" ,xorg-server-for-tests)))
626 (inputs (list sqlite))
627 ;; Listed in 'Requires.private' of 'zathura.pc'.
628 (propagated-inputs (list cairo girara))
629 (native-search-paths
630 (list (search-path-specification
631 (variable "ZATHURA_PLUGINS_PATH")
632 (files '("lib/zathura")))))
633 (build-system meson-build-system)
634 (arguments
635 `(#:meson ,meson-0.59
636 #:phases (modify-phases %standard-phases
637 (add-before 'check 'start-xserver
638 ;; Tests require a running X server.
639 (lambda* (#:key inputs #:allow-other-keys)
640 (let ((xorg-server (assoc-ref inputs "xorg-server"))
641 (display ":1"))
642 (setenv "DISPLAY" display)
643
644 ;; On busy machines, tests may take longer than
645 ;; the default of four seconds.
646 (setenv "CK_DEFAULT_TIMEOUT" "20")
647
648 ;; Don't fail due to missing '/etc/machine-id'.
649 (setenv "DBUS_FATAL_WARNINGS" "0")
650 (zero? (system (string-append xorg-server "/bin/Xvfb "
651 display " &")))))))))
652 (home-page "https://pwmt.org/projects/zathura/")
653 (synopsis "Lightweight keyboard-driven PDF viewer")
654 (description "Zathura is a customizable document viewer. It provides a
655 minimalistic interface and an interface that mainly focuses on keyboard
656 interaction.")
657 (license license:zlib)))
658
659 (define-public podofo
660 (package
661 (name "podofo")
662 (version "0.9.7")
663 (source (origin
664 (method url-fetch)
665 (uri (string-append "mirror://sourceforge/podofo/podofo/" version
666 "/podofo-" version ".tar.gz"))
667 (sha256
668 (base32
669 "1f0yvkx6nf99fp741w2y706d8bs9824x1z2gqm3rdy5fv8bfgwkw"))))
670 (build-system cmake-build-system)
671 (native-inputs
672 (list cppunit pkg-config))
673 (inputs
674 `(("libjpeg" ,libjpeg-turbo)
675 ("libtiff" ,libtiff)
676 ("fontconfig" ,fontconfig)
677 ("freetype" ,freetype)
678 ("libpng" ,libpng)
679 ("lua" ,lua-5.1)
680 ("openssl" ,openssl)
681 ("zlib" ,zlib)))
682 (arguments
683 `(#:configure-flags
684 (list "-DPODOFO_BUILD_SHARED=ON")
685 #:phases
686 (modify-phases %standard-phases
687 (add-before 'configure 'patch
688 (lambda* (#:key inputs #:allow-other-keys)
689 (let ((freetype (assoc-ref inputs "freetype")))
690 ;; Look for freetype include files in the correct place.
691 (substitute* "cmake/modules/FindFREETYPE.cmake"
692 (("/usr/local") freetype)))
693 #t)))))
694 (home-page "http://podofo.sourceforge.net")
695 (synopsis "Tools to work with the PDF file format")
696 (description
697 "PoDoFo is a C++ library and set of command-line tools to work with the
698 PDF file format. It can parse PDF files and load them into memory, and makes
699 it easy to modify them and write the changes to disk. It is primarily useful
700 for applications that wish to do lower level manipulation of PDF, such as
701 extracting content or merging files.")
702 (license license:lgpl2.0+)))
703
704 (define-public mupdf
705 (package
706 (name "mupdf")
707 (version "1.19.0")
708 (source
709 (origin
710 (method url-fetch)
711 (uri (string-append "https://mupdf.com/downloads/archive/"
712 "mupdf-" version "-source.tar.xz"))
713 (sha256
714 (base32 "1i98xqgnzp168hnnhradl8658qsif06wlbvcglz0mmh8wi1rkwrq"))
715 (modules '((guix build utils)))
716 (snippet
717 '(begin
718 ;; Remove bundled software.
719 (let* ((keep (list "extract"
720 "lcms2")) ; different from our lcms2 package
721 (from "thirdparty")
722 (kept (string-append from "~temp")))
723 (mkdir-p kept)
724 (for-each (lambda (file) (rename-file (string-append from "/" file)
725 (string-append kept "/" file)))
726 keep)
727 (delete-file-recursively from)
728 (rename-file kept from))
729 #t))))
730 (build-system gnu-build-system)
731 (inputs
732 `(("curl" ,curl)
733 ("freeglut" ,freeglut)
734 ("freetype" ,freetype)
735 ("gumbo-parser" ,gumbo-parser)
736 ("harfbuzz" ,harfbuzz)
737 ("jbig2dec" ,jbig2dec)
738 ("libjpeg" ,libjpeg-turbo)
739 ("libx11" ,libx11)
740 ("libxext" ,libxext)
741 ("mujs" ,mujs)
742 ("openjpeg" ,openjpeg)
743 ("openssl" ,openssl)
744 ("zlib" ,zlib)))
745 (native-inputs
746 (list pkg-config))
747 (arguments
748 `(#:tests? #f ; no check target
749 #:make-flags (list "verbose=yes"
750 (string-append "CC=" ,(cc-for-target))
751 "XCFLAGS=-fpic"
752 "USE_SYSTEM_LIBS=yes"
753 "USE_SYSTEM_MUJS=yes"
754 "shared=yes"
755 ;; Even with the linkage patch we must fix RUNPATH.
756 (string-append "LDFLAGS=-Wl,-rpath="
757 (assoc-ref %outputs "out") "/lib")
758 (string-append "prefix=" (assoc-ref %outputs "out")))
759 #:phases (modify-phases %standard-phases
760 (delete 'configure)))) ; no configure script
761 (home-page "https://mupdf.com")
762 (synopsis "Lightweight PDF viewer and toolkit")
763 (description
764 "MuPDF is a C library that implements a PDF and XPS parsing and
765 rendering engine. It is used primarily to render pages into bitmaps,
766 but also provides support for other operations such as searching and
767 listing the table of contents and hyperlinks.
768
769 The library ships with a rudimentary X11 viewer, and a set of command
770 line tools for batch rendering @command{pdfdraw}, rewriting files
771 @command{pdfclean}, and examining the file structure @command{pdfshow}.")
772 (license (list license:agpl3+
773 license:bsd-3 ; resources/cmaps
774 license:x11 ; thirdparty/lcms2
775 license:silofl1.1 ; resources/fonts/{han,noto,sil,urw}
776 license:asl2.0)))) ; resources/fonts/droid
777
778 (define-public qpdf
779 (package
780 (name "qpdf")
781 (version "10.0.1")
782 (source (origin
783 (method url-fetch)
784 (uri (string-append "mirror://sourceforge/qpdf/qpdf/" version
785 "/qpdf-" version ".tar.gz"))
786 (sha256
787 (base32
788 "0yw2cpw7ygfd6jlgpwbi8vsnvv9p55zxp9h17x77z2qq733pf8jx"))))
789 (build-system gnu-build-system)
790 (arguments
791 `(#:disallowed-references (,perl)
792 #:phases
793 (modify-phases %standard-phases
794 (add-before 'configure 'patch-paths
795 (lambda _
796 (substitute* "make/libtool.mk"
797 (("SHELL=/bin/bash")
798 (string-append "SHELL=" (which "bash"))))
799 (substitute* (append
800 '("qtest/bin/qtest-driver")
801 (find-files "." "\\.test"))
802 (("/usr/bin/env") (which "env")))
803 #t)))))
804 (native-inputs
805 (list pkg-config perl))
806 (propagated-inputs
807 ;; In Requires.private of libqpdf.pc.
808 (list libjpeg-turbo zlib))
809 (synopsis "Command-line tools and library for transforming PDF files")
810 (description
811 "QPDF is a command-line program that does structural, content-preserving
812 transformations on PDF files. It could have been called something like
813 pdf-to-pdf. It includes support for merging and splitting PDFs and to
814 manipulate the list of pages in a PDF file. It is not a PDF viewer or a
815 program capable of converting PDF into other formats.")
816 ;; Prior to the 7.0 release, QPDF was licensed under Artistic 2.0.
817 ;; Users can still choose to use the old license at their option.
818 (license (list license:asl2.0 license:clarified-artistic))
819 (home-page "http://qpdf.sourceforge.net/")))
820
821 (define-public qpdfview
822 (package
823 (name "qpdfview")
824 (version "0.4.18")
825 (source
826 (origin
827 (method url-fetch)
828 (uri (string-append "https://launchpad.net/qpdfview/"
829 "trunk/" version "/+download/"
830 "qpdfview-" version ".tar.gz"))
831 (sha256
832 (base32 "0v1rl126hvblajnph2hkansgi0s8vjdc5yxrm4y3faa0lxzjwr6c"))
833 (patches (search-patches "qpdfview-qt515-compat.patch"))))
834 (build-system qt-build-system)
835 (native-inputs
836 (list pkg-config))
837 (inputs
838 (list cups
839 djvulibre
840 libspectre
841 poppler-qt5
842 qtbase-5
843 qtsvg))
844 (arguments
845 `(#:tests? #f ; no tests
846 #:phases
847 (modify-phases %standard-phases
848 (replace 'configure
849 (lambda* (#:key outputs #:allow-other-keys)
850 (substitute* "qpdfview.pri"
851 (("/usr") (assoc-ref outputs "out")))
852 (invoke "qmake" "qpdfview.pro"))))))
853 (home-page "https://launchpad.net/qpdfview")
854 (synopsis "Tabbed document viewer")
855 (description "@command{qpdfview} is a document viewer for PDF, PS and DJVU
856 files. It uses the Qt toolkit and features persistent per-file settings,
857 configurable toolbars and shortcuts, continuous and multi‐page layouts,
858 SyncTeX support, and rudimentary support for annotations and forms.")
859 (license license:gpl2+)))
860
861 (define-public xournal
862 (package
863 (name "xournal")
864 (version "0.4.8.2016")
865 (source
866 (origin
867 (method url-fetch)
868 (uri (string-append "mirror://sourceforge/xournal/xournal/" version
869 "/xournal-" version ".tar.gz"))
870 (sha256
871 (base32
872 "09i88v3wacmx7f96dmq0l3afpyv95lh6jrx16xzm0jd1szdrhn5j"))))
873 (build-system gnu-build-system)
874 (inputs
875 (list gtk+-2 pango poppler glib libgnomecanvas))
876 (native-inputs
877 (list pkg-config))
878 (home-page "http://xournal.sourceforge.net/")
879 (synopsis "Notetaking using a stylus")
880 (description
881 "Xournal is an application for notetaking, sketching, keeping a journal
882 using a stylus.")
883 (license license:gpl2+)))
884
885 (define-public xournalpp
886 (package
887 (name "xournalpp")
888 (version "1.1.0")
889 (source
890 (origin
891 (method git-fetch)
892 (uri (git-reference
893 (url "https://github.com/xournalpp/xournalpp")
894 (commit version)))
895 (file-name (git-file-name name version))
896 (sha256
897 (base32 "0ldf58l5sqy52x5dqfpdjdh7ldjilj9mw42jzsl5paxg0md2k0hl"))))
898 (build-system cmake-build-system)
899 (arguments
900 `(#:configure-flags (list "-DENABLE_CPPUNIT=ON") ;enable tests
901 #:imported-modules ((guix build glib-or-gtk-build-system)
902 ,@%cmake-build-system-modules)
903 #:modules (((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:)
904 (guix build cmake-build-system)
905 (guix build utils))
906 #:phases
907 (modify-phases %standard-phases
908 (add-after 'unpack 'fix-permissions-on-po-files
909 (lambda _
910 ;; Make sure 'msgmerge' can modify the PO files.
911 (for-each make-file-writable
912 (find-files "." "\\.po$"))))
913 ;; Fix path to addr2line utility, which the crash reporter uses.
914 (add-after 'unpack 'fix-paths
915 (lambda* (#:key inputs #:allow-other-keys)
916 (substitute* "src/util/Stacktrace.cpp"
917 ;; Match only the commandline.
918 (("\"addr2line ")
919 (string-append "\"" (which "addr2line") " ")))))
920 (add-after 'install 'glib-or-gtk-wrap
921 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))))
922 (native-inputs
923 `(("cppunit" ,cppunit)
924 ("gettext" ,gettext-minimal)
925 ("help2man" ,help2man)
926 ("pkg-config" ,pkg-config)))
927 (inputs
928 (list alsa-lib
929 gtk+
930 librsvg
931 libsndfile
932 libxml2
933 libzip
934 lua
935 poppler
936 portaudio
937 texlive-bin))
938 (home-page "https://github.com/xournalpp/xournalpp")
939 (synopsis "Handwriting notetaking software with PDF annotation support")
940 (description "Xournal++ is a hand note taking software written in
941 C++ with the target of flexibility, functionality and speed. Stroke
942 recognizer and other parts are based on Xournal code.
943
944 Xournal++ features:
945
946 @itemize
947 @item Support for Pen pressure, e.g., Wacom Tablet
948 @item Support for annotating PDFs
949 @item Fill shape functionality
950 @item PDF Export (with and without paper style)
951 @item PNG Export (with and without transparent background)
952 @item Map different tools / colors etc. to stylus buttons /
953 mouse buttons
954 @item Sidebar with Page Previews with advanced page sorting, PDF
955 Bookmarks and Layers (can be individually hidden, editing layer can be
956 selected)
957 @item enhanced support for image insertion
958 @item Eraser with multiple configurations
959 @item LaTeX support
960 @item bug reporting, autosave, and auto backup tools
961 @item Customizeable toolbar, with multiple configurations, e.g., to
962 optimize toolbar for portrait / landscape
963 @item Page Template definitions
964 @item Shape drawing (line, arrow, circle, rectangle)
965 @item Shape resizing and rotation
966 @item Rotation snapping every 45 degrees
967 @item Rect snapping to grid
968 @item Audio recording and playback alongside with handwritten notes
969 @item Multi Language Support, Like English, German, Italian...
970 @item Plugins using LUA Scripting
971 @end itemize")
972 (license license:gpl2+)))
973
974 (define-public python-reportlab
975 (package
976 (name "python-reportlab")
977 (version "3.5.42")
978 (source (origin
979 (method url-fetch)
980 (uri (pypi-uri "reportlab" version))
981 (sha256
982 (base32
983 "0i17qgm7gzy7pzp240mkpsx9rn8rr67jh5npp5bylv3sd41g48cw"))))
984 (build-system python-build-system)
985 (arguments
986 '(;; FIXME: There is one test failure, building the pdf manual from source,
987 ;; but it does not cause the build to fail.
988 #:test-target "tests"
989 #:configure-flags (list "--use-system-libart")
990 #:phases
991 (modify-phases %standard-phases
992 (add-after 'unpack 'find-libraries
993 (lambda* (#:key inputs #:allow-other-keys)
994 (let ((libart (assoc-ref inputs "libart-lgpl"))
995 (freetype (assoc-ref inputs "freetype"))
996 (dlt1 (assoc-ref inputs "font-curve-files")))
997 (substitute* "setup.py"
998 (("/usr/include/libart-\\*")
999 (string-append libart "/include/libart-2.0"))
1000 (("/usr/include/freetype2")
1001 (string-append freetype "/include"))
1002 (("http://www.reportlab.com/ftp/pfbfer-20180109.zip")
1003 (string-append "file://" dlt1)))
1004 #t))))))
1005 (inputs
1006 `(("freetype" ,freetype)
1007 ("libart-lgpl" ,libart-lgpl)
1008 ("font-curve-files"
1009 ,(origin
1010 (method url-fetch)
1011 (uri "http://www.reportlab.com/ftp/pfbfer-20180109.zip")
1012 (sha256
1013 (base32
1014 "1v0gy4mbx02ys96ssx89420y0njknlrxs2bx64bv4rp8a0al66w5"))))))
1015 (propagated-inputs
1016 (list python-pillow))
1017 (home-page "https://www.reportlab.com")
1018 (synopsis "Python library for generating PDFs and graphics")
1019 (description "This is the ReportLab PDF Toolkit. It allows rapid creation
1020 of rich PDF documents, and also creation of charts in a variety of bitmap and
1021 vector formats.")
1022 (license license:bsd-3)))
1023
1024 (define-public python2-reportlab
1025 (package-with-python2 python-reportlab))
1026
1027 (define-public impressive
1028 (package
1029 (name "impressive")
1030 (version "0.12.1")
1031 (source (origin
1032 (method url-fetch)
1033 (uri (string-append
1034 "mirror://sourceforge/impressive/Impressive/"
1035 version "/Impressive-" version ".tar.gz"))
1036 (sha256
1037 (base32
1038 "1r7ihv41awnlnlry1kymb8fka053wdhzibfwcarn78rr3vs338vl"))))
1039 (build-system python-build-system)
1040
1041 ;; TODO: Add dependency on pdftk.
1042 (inputs (list python2-pygame python2-pillow sdl xpdf))
1043
1044 (arguments
1045 `(#:python ,python-2
1046 #:phases (modify-phases %standard-phases
1047 (delete 'build)
1048 (delete 'configure)
1049 (delete 'check)
1050 (replace 'install
1051 (lambda* (#:key inputs outputs #:allow-other-keys)
1052 ;; There's no 'setup.py' so install things manually.
1053 (let* ((out (assoc-ref outputs "out"))
1054 (bin (string-append out "/bin"))
1055 (man1 (string-append out "/share/man/man1"))
1056 (sdl (assoc-ref inputs "sdl"))
1057 (xpdf (assoc-ref inputs "xpdf")))
1058 (mkdir-p bin)
1059 (copy-file "impressive.py"
1060 (string-append bin "/impressive"))
1061 (wrap-program (string-append bin "/impressive")
1062 `("LIBRARY_PATH" ":" prefix ;for ctypes
1063 (,(string-append sdl "/lib")))
1064 `("PATH" ":" prefix ;for pdftoppm
1065 (,(string-append xpdf "/bin"))))
1066 (install-file "impressive.1" man1)
1067 #t))))))
1068 (home-page "http://impressive.sourceforge.net")
1069 (synopsis "PDF presentation tool with visual effects")
1070 (description
1071 "Impressive is a tool to display PDF files that provides visual effects
1072 such as smooth alpha-blended slide transitions. It provides additional tools
1073 such as zooming, highlighting an area of the screen, and a tool to navigate
1074 the PDF pages.")
1075 (license license:gpl2)))
1076
1077 (define-public img2pdf
1078 (package
1079 (name "img2pdf")
1080 (version "0.4.3")
1081 (source
1082 (origin
1083 (method url-fetch)
1084 (uri (pypi-uri "img2pdf" version))
1085 (sha256
1086 (base32 "17z0bn8kihiyqjd1m5jr80m7ry06l1qn0l8v918xg5gs7q2calcf"))))
1087 (build-system python-build-system)
1088 (propagated-inputs
1089 (list python-pikepdf python-pillow
1090 `(,python "tk")))
1091 (home-page "https://gitlab.mister-muffin.de/josch/img2pdf")
1092 (synopsis "Convert images to PDF via direct JPEG inclusion")
1093 (description
1094 "img2pdf converts images to PDF via direct JPEG inclusion. That
1095 conversion is lossless: the image embedded in the PDF has the exact same color
1096 information for every pixel as the input.")
1097 (license license:lgpl3)))
1098
1099 (define-public fbida
1100 (package
1101 (name "fbida")
1102 (version "2.14")
1103 (home-page "https://www.kraxel.org/blog/linux/fbida/")
1104 (source (origin
1105 (method url-fetch)
1106 (uri (string-append "https://www.kraxel.org/releases/fbida/"
1107 "fbida-" version ".tar.gz"))
1108 (sha256
1109 (base32
1110 "0f242mix20rgsqz1llibhsz4r2pbvx6k32rmky0zjvnbaqaw1dwm"))))
1111 (build-system gnu-build-system)
1112 (arguments
1113 `(#:phases
1114 (modify-phases %standard-phases
1115 (add-after 'unpack 'patch-FHS-file-names
1116 (lambda _
1117 (substitute* "mk/Autoconf.mk"
1118 (("/bin/echo") "echo")
1119 (("/sbin/ldconfig -p") "echo lib")) #t))
1120 (add-before 'build 'set-fcommon
1121 (lambda _
1122 (setenv "CFLAGS" "-fcommon")))
1123 (delete 'configure))
1124 #:tests? #f
1125 #:make-flags
1126 (list (string-append "CC=" ,(cc-for-target))
1127 (string-append "prefix=" (assoc-ref %outputs "out")))))
1128 (inputs `(("libjpeg" ,libjpeg-turbo)
1129 ("curl" ,curl)
1130 ("libtiff" ,libtiff)
1131 ("libudev" ,eudev)
1132 ("libwebp" ,libwebp)
1133 ("libdrm" ,libdrm)
1134 ("giflib" ,giflib)
1135 ("glib" ,glib)
1136 ("cairo-xcb" ,cairo-xcb)
1137 ("freetype" ,freetype)
1138 ("fontconfig" ,fontconfig)
1139 ("libexif" ,libexif)
1140 ("mesa" ,mesa)
1141 ("libepoxy" ,libepoxy)
1142 ("libpng" ,libpng)
1143 ("poppler" ,poppler)))
1144 (native-inputs (list pkg-config))
1145 (synopsis "Framebuffer and drm-based image viewer")
1146 (description
1147 "fbida contains a few applications for viewing and editing images on
1148 the framebuffer.")
1149 (license license:gpl2+)))
1150
1151 (define-public pdf2svg
1152 (package
1153 (name "pdf2svg")
1154 (version "0.2.3")
1155 (source (origin
1156 (method git-fetch)
1157 (uri (git-reference
1158 (url "https://github.com/dawbarton/pdf2svg")
1159 (commit (string-append "v" version))))
1160 (file-name (git-file-name name version))
1161 (sha256
1162 (base32
1163 "14ffdm4y26imq99wjhkrhy9lp33165xci1l5ndwfia8hz53bl02k"))))
1164 (build-system gnu-build-system)
1165 (inputs
1166 (list cairo poppler))
1167 (native-inputs
1168 (list pkg-config))
1169 (home-page "http://www.cityinthesky.co.uk/opensource/pdf2svg/")
1170 (synopsis "PDF to SVG converter")
1171 (description "@command{pdf2svg} is a simple command-line PDF to SVG
1172 converter using the Poppler and Cairo libraries.")
1173 (license license:gpl2+)))
1174
1175 (define-public python-pypdf2
1176 (package
1177 (name "python-pypdf2")
1178 (version "1.26.0")
1179 (source (origin
1180 (method url-fetch)
1181 (uri (pypi-uri "PyPDF2" version))
1182 (sha256
1183 (base32
1184 "11a3aqljg4sawjijkvzhs3irpw0y67zivqpbjpm065ha5wpr13z2"))))
1185 (build-system python-build-system)
1186 (arguments
1187 `(#:phases
1188 (modify-phases %standard-phases
1189 (add-after
1190 'unpack 'patch-test-suite
1191 (lambda _
1192 ;; The text-file needs to be opened in binary mode for Python 3,
1193 ;; so patch in the "b"
1194 (substitute* "Tests/tests.py"
1195 (("pdftext_file = open\\(.* 'crazyones.txt'\\), 'r" line)
1196 (string-append line "b")))
1197 #t))
1198 (replace 'check
1199 (lambda _
1200 (invoke "python" "-m" "unittest" "Tests.tests"))))))
1201 (home-page "http://mstamy2.github.com/PyPDF2")
1202 (synopsis "Pure Python PDF toolkit")
1203 (description "PyPDF2 is a pure Python PDF library capable of:
1204
1205 @enumerate
1206 @item extracting document information (title, author, …)
1207 @item splitting documents page by page
1208 @item merging documents page by page
1209 @item cropping pages
1210 @item merging multiple pages into a single page
1211 @item encrypting and decrypting PDF files
1212 @end enumerate
1213
1214 By being pure Python, it should run on any Python platform without any
1215 dependencies on external libraries. It can also work entirely on
1216 @code{StringIO} objects rather than file streams, allowing for PDF
1217 manipulation in memory. It is therefore a useful tool for websites that
1218 manage or manipulate PDFs.")
1219 (license license:bsd-3)))
1220
1221 (define-public python2-pypdf2
1222 (package-with-python2 python-pypdf2))
1223
1224 (define-public python2-pypdf
1225 (package
1226 (name "python2-pypdf")
1227 (version "1.13")
1228 (source (origin
1229 (method url-fetch)
1230 (uri (pypi-uri "pyPdf" version))
1231 (sha256
1232 (base32
1233 "0fqfvamir7k41w84c73rghzkiv891gdr17q5iz4hgbf6r71y9v9s"))))
1234 (build-system python-build-system)
1235 (arguments
1236 `(#:tests? #f ; no tests
1237 #:python ,python-2))
1238 (home-page "http://pybrary.net/pyPdf/")
1239 (synopsis "Pure Python PDF toolkit")
1240 (description "PyPDF2 is a pure Python PDF toolkit.
1241
1242 Note: This module isn't maintained anymore. For new projects please use
1243 python-pypdf2 instead.")
1244 (license license:bsd-3)))
1245
1246 (define-public pdfarranger
1247 (package
1248 (name "pdfarranger")
1249 (version "1.8.2")
1250 (source
1251 (origin
1252 (method git-fetch)
1253 (uri (git-reference
1254 (url "https://github.com/jeromerobert/pdfarranger")
1255 (commit version)))
1256 (file-name (git-file-name name version))
1257 (sha256
1258 (base32 "18bpnnwjx72d5ps06dr89mkixiwzc9hf5gr75k8qcnrkshl038v2"))))
1259 (build-system python-build-system)
1260 (arguments
1261 '(#:tests? #f ;no tests
1262 #:phases
1263 (modify-phases %standard-phases
1264 (add-after 'install 'wrap-for-typelib
1265 (lambda* (#:key inputs outputs #:allow-other-keys)
1266 (let* ((out (assoc-ref outputs "out"))
1267 (program (string-append out "/bin/pdfarranger")))
1268 (wrap-program program
1269 `("GI_TYPELIB_PATH" ":" prefix
1270 (,(getenv "GI_TYPELIB_PATH"))))))))))
1271 (native-inputs
1272 (list intltool python-distutils-extra))
1273 (inputs
1274 (list gtk+ poppler))
1275 (propagated-inputs
1276 (list img2pdf
1277 python-dateutil
1278 python-pikepdf
1279 python-pycairo
1280 python-pygobject))
1281 (home-page "https://github.com/jeromerobert/pdfarranger")
1282 (synopsis "Merge, split and re-arrange pages from PDF documents")
1283 (description
1284 "PDF Arranger is a small application which allows one to merge or split
1285 PDF documents and rotate, crop and rearrange their pages using an interactive
1286 and intuitive graphical interface.
1287
1288 PDF Arranger was formerly known as PDF-Shuffler.")
1289 (license license:gpl3+)))
1290
1291 (define-public pdfposter
1292 (package
1293 (name "pdfposter")
1294 (version "0.7.post1")
1295 (source (origin
1296 (method url-fetch)
1297 (uri (pypi-uri "pdftools.pdfposter" version))
1298 (sha256
1299 (base32
1300 "0c1avpbr9q53yzq5ar2x485rmp9d0l3z27aham32bg7gplzd7w0j"))))
1301 (build-system python-build-system)
1302 (arguments
1303 `(#:tests? #f)) ; test-suite not included in source archive
1304 (inputs
1305 (list python-pypdf2))
1306 (home-page "https://pythonhosted.org/pdftools.pdfposter/")
1307 (synopsis "Scale and tile PDF images/pages to print on multiple pages")
1308 (description "@command{pdfposter} can be used to create a large poster by
1309 building it from multiple pages and/or printing it on large media. It expects
1310 as input a PDF file, normally printing on a single page. The output is again
1311 a PDF file, maybe containing multiple pages together building the poster. The
1312 input page will be scaled to obtain the desired size.
1313
1314 This is much like @command{poster} does for Postscript files, but working with
1315 PDF. Since sometimes @command{poster} does not like your files converted from
1316 PDF. Indeed @command{pdfposter} was inspired by @command{poster}.")
1317 (license license:gpl3+)))
1318
1319 (define-public pdfgrep
1320 (package
1321 (name "pdfgrep")
1322 (version "2.1.2")
1323 (source
1324 (origin
1325 (method url-fetch)
1326 (uri (string-append "https://pdfgrep.org/download/"
1327 name "-" version ".tar.gz"))
1328 (sha256
1329 (base32
1330 "1fia10djcxxl7n9jw2prargw4yzbykk6izig2443ycj9syhxrwqf"))))
1331 (build-system gnu-build-system)
1332 (native-inputs
1333 (list pkg-config))
1334 (inputs
1335 (list libgcrypt pcre poppler))
1336 (home-page "https://pdfgrep.org")
1337 (synopsis "Command-line utility to search text in PDF files")
1338 (description
1339 "Pdfgrep searches in pdf files for strings matching a regular expression.
1340 Support some GNU grep options as file name output, page number output,
1341 optional case insensitivity, count occurrences, color highlights and search in
1342 multiple files.")
1343 (license license:gpl2+)))
1344
1345 (define-public pdfpc
1346 (package
1347 (name "pdfpc")
1348 (version "4.5.0")
1349 (source
1350 (origin
1351 (method git-fetch)
1352 (uri (git-reference
1353 (url "https://github.com/pdfpc/pdfpc")
1354 (commit (string-append "v" version))))
1355 (file-name (git-file-name name version))
1356 (sha256
1357 (base32 "0bmy51w6ypz927hxwp5g7wapqvzqmsi3w32rch6i3f94kg1152ck"))))
1358 (build-system cmake-build-system)
1359 (arguments
1360 '(#:tests? #f ; no test target
1361 #:phases
1362 (modify-phases %standard-phases
1363 ;; This is really a bug in Vala.
1364 ;; https://github.com/pdfpc/pdfpc/issues/594
1365 (add-after 'unpack 'fix-vala-API-conflict
1366 (lambda _
1367 (substitute* "src/classes/action/movie.vala"
1368 (("info.from_caps\\(caps\\)")
1369 "Gst.Video.info_from_caps(out info, caps)")))))))
1370 (inputs
1371 `(("cairo" ,cairo)
1372 ("discount" ,discount) ; libmarkdown
1373 ("gtk+" ,gtk+)
1374 ("gstreamer" ,gstreamer)
1375 ("gst-plugins-base" ,gst-plugins-base)
1376 ("json-glib" ,json-glib)
1377 ("libgee" ,libgee)
1378 ("poppler" ,poppler)
1379 ("pango" ,pango)
1380 ("vala" ,vala)
1381 ("webkitgtk" ,webkitgtk-with-libsoup2)))
1382 (native-inputs
1383 (list pkg-config))
1384 (home-page "https://pdfpc.github.io/")
1385 (synopsis "Presenter console with multi-monitor support for PDF files")
1386 (description
1387 "pdfpc is a presentation viewer application which uses multi-monitor
1388 output to provide meta information to the speaker during the presentation. It
1389 is able to show a normal presentation window on one screen, while showing a
1390 more sophisticated overview on the other one providing information like a
1391 picture of the next slide, as well as the left over time till the end of the
1392 presentation. The input files processed by pdfpc are PDF documents.")
1393 (license license:gpl3+)))
1394
1395 (define-public paps
1396 (package
1397 (name "paps")
1398 (version "0.7.1")
1399 (source
1400 (origin
1401 (method url-fetch)
1402 (uri (string-append "https://github.com/dov/paps/releases/download/v"
1403 version "/paps-" version ".tar.gz"))
1404 (sha256
1405 (base32 "1z1w1fg2bvb8p92n1jlpqp3n9mq42szb2mqhh4xqmmnmfcdkpi9s"))))
1406 (build-system gnu-build-system)
1407 (inputs
1408 (list pango))
1409 (native-inputs
1410 (list intltool pkg-config))
1411 (home-page "https://github.com/dov/paps")
1412 (synopsis "Pango to PostScript converter")
1413 (description
1414 "Paps reads a UTF-8 encoded file and generates a PostScript language
1415 rendering of the file through the Pango Cairo back end.")
1416 (license license:lgpl2.0+)))
1417
1418 (define-public stapler
1419 (package
1420 (name "stapler")
1421 (version "1.0.0")
1422 (source
1423 (origin
1424 (method url-fetch)
1425 (uri (pypi-uri "stapler" version))
1426 (sha256
1427 (base32
1428 "0b2lbm3f79cdxcsagwhzihbzwahjabxqmbws0c8ki25gpdnygdd7"))))
1429 (build-system python-build-system)
1430 (arguments
1431 '(#:phases
1432 (modify-phases %standard-phases
1433 (add-after 'unpack 'fix-more-itertools-version-requirement
1434 (lambda _
1435 ;; Tests require an version of the more-itertools module older
1436 ;; than the one we have packaged.
1437 (substitute* "setup.py"
1438 (("more-itertools>=2\\.2,<6\\.0\\.0") "more-itertools>=2.2"))
1439 #t)))))
1440 (propagated-inputs
1441 (list python-more-itertools python-pypdf2))
1442 (home-page "https://github.com/hellerbarde/stapler")
1443 (synopsis "PDF manipulation tool")
1444 (description "Stapler is a pure Python alternative to PDFtk, a tool for
1445 manipulating PDF documents from the command line. It supports
1446
1447 @itemize
1448 @item cherry-picking pages and concatenating them into a new file
1449 @item splitting a PDF document into single pages each in its own file
1450 @item merging PDF documents with their pages interleaved
1451 @item displaying metadata in a PDF document
1452 @item displaying the mapping between logical and physical page numbers
1453 @end itemize")
1454 (license license:bsd-3)))
1455
1456 (define-public weasyprint
1457 (package
1458 (name "weasyprint")
1459 (version "52.1")
1460 (source
1461 (origin
1462 (method git-fetch)
1463 (uri (git-reference
1464 (url "https://github.com/FelixSchwarz/WeasyPrint")
1465 (commit (string-append "v" version))))
1466 (file-name (git-file-name name version))
1467 (sha256
1468 (base32
1469 "0rcj9yah3bp6bbvkmny3w4csx4l5v49lc7mrk29g0x77qnwswjy7"))))
1470 (build-system python-build-system)
1471 (arguments
1472 `(#:phases
1473 (modify-phases %standard-phases
1474 (add-after 'unpack 'patch-library-paths
1475 (lambda* (#:key inputs #:allow-other-keys)
1476 (let ((fontconfig (assoc-ref inputs "fontconfig"))
1477 (glib (assoc-ref inputs "glib"))
1478 (pango (assoc-ref inputs "pango"))
1479 (pangoft2 (assoc-ref inputs "pangoft2")))
1480 (substitute* "weasyprint/fonts.py"
1481 (("'fontconfig'")
1482 (format #f "'~a/lib/libfontconfig.so'" fontconfig))
1483 (("'pangoft2-1.0'")
1484 (format #f "'~a/lib/libpangoft2-1.0.so'" pango)))
1485 (substitute* "weasyprint/text.py"
1486 (("'gobject-2.0'")
1487 (format #f "'~a/lib/libgobject-2.0.so'" glib))
1488 (("'pango-1.0'")
1489 (format #f "'~a/lib/libpango-1.0.so'" pango))
1490 (("'pangocairo-1.0'")
1491 (format #f "'~a/lib/libpangocairo-1.0.so'" pango)))
1492 #t)))
1493 (add-after 'unpack 'disable-linters
1494 ;; Their check fails; none of our business.
1495 (lambda _
1496 (substitute* "setup.cfg"
1497 ((".*pytest-flake8.*") "")
1498 ((".*pytest-isort.*") "")
1499 (("--flake8") "")
1500 (("--isort") ""))
1501 #t))
1502 (add-before 'check 'register-dejavu-font
1503 (lambda* (#:key inputs #:allow-other-keys)
1504 ;; TODO: fix FreeType so that fonts found in XDG_DATA_DIRS are
1505 ;; honored.
1506 (let* ((HOME "/tmp")
1507 (dejavu (assoc-ref inputs "font-dejavu"))
1508 (fonts-dir (string-append HOME "/.fonts")))
1509 (setenv "HOME" HOME)
1510 (mkdir-p fonts-dir)
1511 (symlink (string-append dejavu "/share/fonts/truetype")
1512 (string-append fonts-dir "/truetype"))
1513 (invoke "fc-cache" "-rv")))))))
1514 (inputs
1515 `(("fontconfig" ,fontconfig)
1516 ("glib" ,glib)
1517 ("pango" ,pango)))
1518 (propagated-inputs
1519 (list gdk-pixbuf
1520 python-cairocffi
1521 python-cairosvg
1522 python-cffi
1523 python-cssselect2
1524 python-html5lib
1525 python-pyphen
1526 python-tinycss2))
1527 (native-inputs
1528 (list font-dejavu ;tests depend on it
1529 python-pytest-cov python-pytest-runner))
1530 (home-page "https://weasyprint.org/")
1531 (synopsis "Document factory for creating PDF files from HTML")
1532 (description "WeasyPrint helps web developers to create PDF documents. It
1533 turns simple HTML pages into gorgeous statistical reports, invoices, tickets,
1534 etc.
1535
1536 From a technical point of view, WeasyPrint is a visual rendering engine for
1537 HTML and CSS that can export to PDF and PNG. It aims to support web standards
1538 for printing.
1539
1540 It is based on various libraries but not on a full rendering engine like
1541 WebKit or Gecko. The CSS layout engine is written in Python, designed for
1542 pagination, and meant to be easy to hack on. Weasyprint can also be used as a
1543 python library.
1544
1545 Keywords: html2pdf, htmltopdf")
1546 (license license:bsd-3)))