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