Merge branch 'master' into core-updates
[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 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 ng0 <ng0@we.make.ritual.n0.is>
8 ;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
9 ;;; Copyright © 2016, 2017 Marius Bakke <mbakke@fastmail.com>
10 ;;; Copyright © 2016, 2017 Ludovic Courtès <ludo@gnu.org>
11 ;;; Copyright © 2016 Julien Lepiller <julien@lepiller.eu>
12 ;;; Copyright © 2016 Arun Isaac <arunisaac@systemreboot.net>
13 ;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
14 ;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com>
15 ;;; Copyright © 2017 Rene Saavedra <rennes@openmailbox.org>
16 ;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
17 ;;;
18 ;;; This file is part of GNU Guix.
19 ;;;
20 ;;; GNU Guix is free software; you can redistribute it and/or modify it
21 ;;; under the terms of the GNU General Public License as published by
22 ;;; the Free Software Foundation; either version 3 of the License, or (at
23 ;;; your option) any later version.
24 ;;;
25 ;;; GNU Guix is distributed in the hope that it will be useful, but
26 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
27 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 ;;; GNU General Public License for more details.
29 ;;;
30 ;;; You should have received a copy of the GNU General Public License
31 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
32
33 (define-module (gnu packages pdf)
34 #:use-module ((guix licenses) #:prefix license:)
35 #:use-module (guix packages)
36 #:use-module (guix download)
37 #:use-module (guix utils)
38 #:use-module (guix build-system gnu)
39 #:use-module (guix build-system cmake)
40 #:use-module (guix build-system python)
41 #:use-module (guix build-system trivial)
42 #:use-module (gnu packages)
43 #:use-module (gnu packages autotools)
44 #:use-module (gnu packages backup)
45 #:use-module (gnu packages base)
46 #:use-module (gnu packages bash)
47 #:use-module (gnu packages check)
48 #:use-module (gnu packages compression)
49 #:use-module (gnu packages curl)
50 #:use-module (gnu packages databases)
51 #:use-module (gnu packages djvu)
52 #:use-module (gnu packages fontutils)
53 #:use-module (gnu packages game-development)
54 #:use-module (gnu packages gettext)
55 #:use-module (gnu packages ghostscript)
56 #:use-module (gnu packages gl)
57 #:use-module (gnu packages glib)
58 #:use-module (gnu packages gnome)
59 #:use-module (gnu packages gnupg)
60 #:use-module (gnu packages gtk)
61 #:use-module (gnu packages image)
62 #:use-module (gnu packages imagemagick)
63 #:use-module (gnu packages javascript)
64 #:use-module (gnu packages lesstif)
65 #:use-module (gnu packages linux)
66 #:use-module (gnu packages lua)
67 #:use-module (gnu packages pcre)
68 #:use-module (gnu packages perl)
69 #:use-module (gnu packages photo)
70 #:use-module (gnu packages pkg-config)
71 #:use-module (gnu packages python)
72 #:use-module (gnu packages qt)
73 #:use-module (gnu packages sdl)
74 #:use-module (gnu packages tls)
75 #:use-module (gnu packages xdisorg)
76 #:use-module (gnu packages xorg)
77 #:use-module (srfi srfi-1))
78
79 (define-public poppler
80 (package
81 (name "poppler")
82 (version "0.62.0")
83 (source (origin
84 (method url-fetch)
85 (uri (string-append "https://poppler.freedesktop.org/poppler-"
86 version ".tar.xz"))
87 (sha256
88 (base32
89 "1ii9ly1pngyvs0aiq2wxpya08hidpl54y7nsb8b1vxnnskgp76jv"))))
90 (build-system cmake-build-system)
91 ;; FIXME:
92 ;; use libcurl: no
93 (inputs `(("fontconfig" ,fontconfig)
94 ("freetype" ,freetype)
95 ("libjpeg" ,libjpeg)
96 ("libpng" ,libpng)
97 ("libtiff" ,libtiff)
98 ("lcms" ,lcms)
99 ("openjpeg" ,openjpeg)
100 ("zlib" ,zlib)
101
102 ;; To build poppler-glib (as needed by Evince), we need Cairo and
103 ;; GLib. But of course, that Cairo must not depend on Poppler.
104 ("cairo" ,(package (inherit cairo)
105 (inputs (alist-delete "poppler"
106 (package-inputs cairo)))))
107 ("glib" ,glib)))
108 (native-inputs
109 `(("pkg-config" ,pkg-config)
110 ("glib" ,glib "bin") ; glib-mkenums, etc.
111 ("gobject-introspection" ,gobject-introspection)))
112 (arguments
113 `(#:tests? #f ; no test data provided with the tarball
114 #:configure-flags
115 (let* ((out (assoc-ref %outputs "out"))
116 (lib (string-append out "/lib")))
117 (list "-DENABLE_XPDF_HEADERS=ON" ; to install header files
118 "-DENABLE_ZLIB=ON"
119 (string-append "-DCMAKE_INSTALL_LIBDIR=" lib)
120 (string-append "-DCMAKE_INSTALL_RPATH=" lib)))))
121 (synopsis "PDF rendering library")
122 (description
123 "Poppler is a PDF rendering library based on the xpdf-3.0 code base.")
124 (license license:gpl2+)
125 (home-page "https://poppler.freedesktop.org/")))
126
127 (define-public poppler-qt4
128 (package (inherit poppler)
129 (name "poppler-qt4")
130 (inputs `(("qt-4" ,qt-4)
131 ,@(package-inputs poppler)))
132 (synopsis "Qt4 frontend for the Poppler PDF rendering library")))
133
134 (define-public poppler-qt5
135 (package (inherit poppler)
136 (name "poppler-qt5")
137 (inputs `(("qtbase" ,qtbase)
138 ,@(package-inputs poppler)))
139 (synopsis "Qt5 frontend for the Poppler PDF rendering library")))
140
141 (define-public python-poppler-qt4
142 (package
143 (name "python-poppler-qt4")
144 (version "0.24.0")
145 (source
146 (origin
147 (method url-fetch)
148 (uri (string-append "https://pypi.python.org/packages/source/p"
149 "/python-poppler-qt4/python-poppler-qt4-"
150 version ".tar.gz"))
151 (sha256
152 (base32
153 "0x63niylkk4q3h3ay8zrk3m1xiik0x3hlr4gvj7kswx48qi1vb99"))))
154 (build-system python-build-system)
155 (arguments
156 `(#:phases
157 (modify-phases %standard-phases
158 (add-after
159 'unpack 'patch-poppler-include-paths
160 (lambda _
161 (substitute* (find-files "." "poppler-.*\\.sip")
162 (("qt4/poppler-.*\\.h" header)
163 (string-append "poppler/" header)))
164 #t)))))
165 (native-inputs
166 `(("pkg-config" ,pkg-config)))
167 (inputs
168 `(("python-sip" ,python-sip)
169 ("python-pyqt-4" ,python-pyqt-4)
170 ("poppler-qt4" ,poppler-qt4)))
171 (home-page "https://pypi.python.org/pypi/python-poppler-qt4")
172 (synopsis "Python bindings for Poppler-Qt4")
173 (description
174 "This package provides Python bindings for the Qt4 interface of the
175 Poppler PDF rendering library.")
176 (license license:lgpl2.1+)))
177
178 (define-public python-poppler-qt5
179 (package
180 (name "python-poppler-qt5")
181 (version "0.24.2")
182 (source
183 (origin
184 (method url-fetch)
185 (uri (pypi-uri "python-poppler-qt5" version))
186 (sha256
187 (base32
188 "0l69llw1fzwz8y90q0qp9q5pifbrqjjbwii7di54dwghw5fc6w1r"))))
189 (build-system python-build-system)
190 (arguments
191 `(;; There are no tests. The check phase just causes a rebuild.
192 #:tests? #f
193 #:phases
194 (modify-phases %standard-phases
195 (replace 'build
196 (lambda* (#:key inputs #:allow-other-keys)
197 (substitute* "setup.py"
198 ;; This check always fails, so disable it.
199 (("if not check_qtxml\\(\\)")
200 "if True")
201 ;; Enable C++11, which is needed because of Qt5.
202 (("\\*\\*ext_args" line)
203 (string-append "extra_compile_args=['-std=gnu++11'], " line)))
204 ;; We need to pass an extra flag here. This cannot be in
205 ;; configure-flags because it should not be passed for the
206 ;; installation phase.
207 ((@@ (guix build python-build-system) call-setuppy)
208 "build_ext" (list (string-append "--pyqt-sip-dir="
209 (assoc-ref inputs "python-pyqt")
210 "/share/sip")) #t))))))
211 (native-inputs
212 `(("pkg-config" ,pkg-config)))
213 (inputs
214 `(("python-sip" ,python-sip)
215 ("python-pyqt" ,python-pyqt)
216 ("poppler-qt5" ,poppler-qt5)
217 ("qtbase" ,qtbase)))
218 (home-page "https://pypi.python.org/pypi/python-poppler-qt5")
219 (synopsis "Python bindings for Poppler-Qt5")
220 (description
221 "This package provides Python bindings for the Qt5 interface of the
222 Poppler PDF rendering library.")
223 (license license:lgpl2.1+)))
224
225 (define-public libharu
226 (package
227 (name "libharu")
228 (version "2.3.0")
229 (source (origin
230 (method url-fetch)
231 (uri (string-append "https://github.com/libharu/libharu/archive/"
232 "RELEASE_"
233 (string-join (string-split version #\.) "_")
234 ".tar.gz"))
235 (file-name (string-append name "-" version ".tar.gz"))
236 (sha256
237 (base32
238 "1lm4v539y9cb1lvbq387j57sy7yxda3yv8b1pk8m6zazbp66i7lg"))))
239 (build-system gnu-build-system)
240 (arguments
241 `(#:configure-flags
242 (list (string-append "--with-zlib="
243 (assoc-ref %build-inputs "zlib"))
244 (string-append "--with-png="
245 (assoc-ref %build-inputs "libpng")))
246 #:phases
247 (modify-phases %standard-phases
248 (add-after 'unpack 'autogen
249 (lambda _ (zero? (system* "autoreconf" "-vif")))))))
250 (inputs
251 `(("zlib" ,zlib)
252 ("libpng" ,libpng)))
253 (native-inputs
254 `(("autoconf" ,autoconf)
255 ("automake" ,automake)
256 ("libtool" ,libtool)))
257 (home-page "http://libharu.org/")
258 (synopsis "Library for generating PDF files")
259 (description
260 "libHaru is a library for generating PDF files. libHaru does not support
261 reading and editing of existing PDF files.")
262 (license license:zlib)))
263
264 (define-public xpdf
265 (package
266 (name "xpdf")
267 (version "3.04")
268 (source (origin
269 (method url-fetch)
270 (uri (string-append "ftp://ftp.foolabs.com/pub/xpdf/xpdf-"
271 version ".tar.gz"))
272 (sha256 (base32
273 "1rbp54mr3z2x3a3a1qmz8byzygzi223vckfam9ib5g1sfds0qf8i"))))
274 (build-system gnu-build-system)
275 (inputs `(("freetype" ,freetype)
276 ("gs-fonts" ,gs-fonts)
277 ("lesstif" ,lesstif)
278 ("libpaper" ,libpaper)
279 ("libx11" ,libx11)
280 ("libxext" ,libxext)
281 ("libxp" ,libxp)
282 ("libxpm" ,libxpm)
283 ("libxt" ,libxt)
284 ("libpng" ,libpng)
285 ("zlib" ,zlib)))
286 (arguments
287 `(#:tests? #f ; there is no check target
288 #:parallel-build? #f ; build fails randomly on 8-way machines
289 #:configure-flags
290 (list (string-append "--with-freetype2-includes="
291 (assoc-ref %build-inputs "freetype")
292 "/include/freetype2"))
293 #:phases
294 (modify-phases %standard-phases
295 (replace 'install
296 (lambda* (#:key outputs inputs #:allow-other-keys #:rest args)
297 (let* ((install (assoc-ref %standard-phases 'install))
298 (out (assoc-ref outputs "out"))
299 (xpdfrc (string-append out "/etc/xpdfrc"))
300 (gs-fonts (assoc-ref inputs "gs-fonts")))
301 (apply install args)
302 (substitute* xpdfrc
303 (("/usr/local/share/ghostscript/fonts")
304 (string-append gs-fonts "/share/fonts/type1/ghostscript"))
305 (("#fontFile") "fontFile")))
306 #t)))))
307 (synopsis "Viewer for PDF files based on the Motif toolkit")
308 (description
309 "Xpdf is a viewer for Portable Document Format (PDF) files.")
310 (license license:gpl3) ; or gpl2, but not gpl2+
311 (home-page "http://www.foolabs.com/xpdf/")))
312
313 (define-public zathura-cb
314 (package
315 (name "zathura-cb")
316 (version "0.1.7")
317 (source (origin
318 (method url-fetch)
319 (uri
320 (string-append "https://pwmt.org/projects/zathura-cb/download/zathura-cb-"
321 version ".tar.gz"))
322 (sha256
323 (base32
324 "0r4viisycj39kaz4281cmkr7n9w5q96dmlf7nf45n8zq8qy2npw3"))))
325 (native-inputs `(("pkg-config" ,pkg-config)))
326 (propagated-inputs `(("girara" ,girara)))
327 (inputs `(("libarchive" ,libarchive)
328 ("zathura" ,zathura)))
329 (build-system gnu-build-system)
330 (arguments
331 `(#:make-flags (list (string-append "PREFIX=" %output)
332 (string-append "PLUGINDIR=" %output "/lib/zathura")
333 "CC=gcc")
334 #:tests? #f ; Package does not contain tests.
335 #:phases
336 (modify-phases %standard-phases (delete 'configure))))
337 (home-page "https://pwmt.org/projects/zathura-cb/")
338 (synopsis "Comic book support for zathura (libarchive backend)")
339 (description "The zathura-cb plugin adds comic book support to zathura
340 using libarchive.")
341 (license license:zlib)))
342
343 (define-public zathura-ps
344 (package
345 (name "zathura-ps")
346 (version "0.2.5")
347 (source (origin
348 (method url-fetch)
349 (uri
350 (string-append "https://pwmt.org/projects/zathura-ps/download/zathura-ps-"
351 version ".tar.gz"))
352 (sha256
353 (base32
354 "1x4knqja8pw2a5cb3y2209nr3iddj1z8nwasy48v5nprj61fdxqj"))))
355 (native-inputs `(("pkg-config" ,pkg-config)))
356 (propagated-inputs `(("girara" ,girara)))
357 (inputs `(("libspectre" ,libspectre)
358 ("zathura" ,zathura)))
359 (build-system gnu-build-system)
360 (arguments
361 `(#:make-flags (list (string-append "PREFIX=" %output)
362 (string-append "PLUGINDIR=" %output "/lib/zathura")
363 "CC=gcc")
364 #:tests? #f ; Package does not contain tests.
365 #:phases
366 (modify-phases %standard-phases (delete 'configure))))
367 (home-page "https://pwmt.org/projects/zathura-ps/")
368 (synopsis "PS support for zathura (libspectre backend)")
369 (description "The zathura-ps plugin adds PS support to zathura
370 using libspectre.")
371 (license license:zlib)))
372
373 (define-public zathura-djvu
374 (package
375 (name "zathura-djvu")
376 (version "0.2.7")
377 (source (origin
378 (method url-fetch)
379 (uri
380 (string-append "https://pwmt.org/projects/zathura-djvu/download/zathura-djvu-"
381 version ".tar.gz"))
382 (sha256
383 (base32
384 "1sbfdsyp50qc85xc4458sn4w1rv1qbygdwmcr5kjlfpsmdq98vhd"))))
385 (native-inputs `(("pkg-config" ,pkg-config)))
386 (propagated-inputs `(("girara" ,girara)))
387 (inputs
388 `(("djvulibre" ,djvulibre)
389 ("zathura" ,zathura)))
390 (build-system gnu-build-system)
391 (arguments
392 `(#:make-flags (list (string-append "PREFIX=" %output)
393 (string-append "PLUGINDIR=" %output "/lib/zathura")
394 "CC=gcc")
395 #:tests? #f ; Package does not contain tests.
396 #:phases
397 (modify-phases %standard-phases (delete 'configure))))
398 (home-page "https://pwmt.org/projects/zathura-djvu/")
399 (synopsis "DjVu support for zathura (DjVuLibre backend)")
400 (description "The zathura-djvu plugin adds DjVu support to zathura
401 using the DjVuLibre library.")
402 (license license:zlib)))
403
404 (define-public zathura-pdf-mupdf
405 (package
406 (name "zathura-pdf-mupdf")
407 (version "0.3.2")
408 (source (origin
409 (method url-fetch)
410 (uri
411 (string-append "https://pwmt.org/projects/zathura-pdf-mupdf"
412 "/download/zathura-pdf-mupdf-" version ".tar.gz"))
413 (sha256
414 (base32
415 "0xkajc3is7ncmb2fmymbzfgrran2bz12i7zsm1vvxhxds728h7ck"))))
416 (native-inputs `(("pkg-config" ,pkg-config)))
417 (propagated-inputs `(("girara" ,girara)))
418 (inputs
419 `(("jbig2dec" ,jbig2dec)
420 ("libjpeg" ,libjpeg)
421 ("mupdf" ,mupdf)
422 ("openjpeg" ,openjpeg)
423 ("openssl" ,openssl)
424 ("zathura" ,zathura)))
425 (build-system gnu-build-system)
426 (arguments
427 `(#:make-flags (list (string-append "PREFIX=" %output)
428 (string-append "PLUGINDIR=" %output "/lib/zathura")
429 "CC=gcc")
430 #:tests? #f ;No tests.
431 #:phases (modify-phases %standard-phases (delete 'configure))))
432 (home-page "https://pwmt.org/projects/zathura-pdf-mupdf/")
433 (synopsis "PDF support for zathura (mupdf backend)")
434 (description "The zathura-pdf-mupdf plugin adds PDF support to zathura
435 by using the @code{mupdf} rendering library.")
436 (license license:zlib)))
437
438 (define-public zathura-pdf-poppler
439 (package
440 (name "zathura-pdf-poppler")
441 (version "0.2.8")
442 (source (origin
443 (method url-fetch)
444 (uri
445 (string-append "https://pwmt.org/projects/zathura-pdf-poppler/download/zathura-pdf-poppler-"
446 version ".tar.gz"))
447 (sha256
448 (base32
449 "1m55m7s7f8ng8a7lmcw9z4n5zv7xk4vp9n6fp9j84z6rk2imf7a2"))))
450 (native-inputs `(("pkg-config" ,pkg-config)))
451 (propagated-inputs `(("girara" ,girara)))
452 (inputs
453 `(("poppler" ,poppler)
454 ("zathura" ,zathura)))
455 (build-system gnu-build-system)
456 (arguments
457 `(#:make-flags (list (string-append "PREFIX=" %output)
458 (string-append "PLUGINDIR=" %output "/lib/zathura")
459 "CC=gcc")
460 #:tests? #f ; Package does not include tests.
461 #:phases
462 (modify-phases %standard-phases (delete 'configure))))
463 (home-page "https://pwmt.org/projects/zathura-pdf-poppler/")
464 (synopsis "PDF support for zathura (poppler backend)")
465 (description "The zathura-pdf-poppler plugin adds PDF support to zathura
466 by using the poppler rendering engine.")
467 (license license:zlib)))
468
469 (define-public zathura
470 (package
471 (name "zathura")
472 (version "0.3.8")
473 (source (origin
474 (method url-fetch)
475 (uri
476 (string-append "https://pwmt.org/projects/zathura/download/zathura-"
477 version ".tar.gz"))
478 (sha256
479 (base32
480 "0dz5pky3vmf3s2cp2rv1c099gb1s49p9xlgm3ghyy4pzyxc8bgs6"))
481 (patches (search-patches
482 "zathura-plugindir-environment-variable.patch"))))
483 (native-inputs `(("pkg-config" ,pkg-config)
484 ("gettext" ,gettext-minimal)
485 ("glib:bin" ,glib "bin")
486
487 ;; For tests.
488 ("check" ,check)
489 ("xorg-server" ,xorg-server)))
490 (inputs `(("sqlite" ,sqlite)))
491 ;; Listed in 'Requires.private' of 'zathura.pc'.
492 (propagated-inputs `(("cairo" ,cairo)
493 ("girara" ,girara)))
494 (native-search-paths
495 (list (search-path-specification
496 (variable "ZATHURA_PLUGIN_PATH")
497 (files '("lib/zathura")))))
498 (build-system gnu-build-system)
499 (arguments
500 `(#:make-flags
501 `(,(string-append "PREFIX=" (assoc-ref %outputs "out"))
502 "CC=gcc" "COLOR=0")
503 #:test-target "test"
504 #:phases (modify-phases %standard-phases
505 (delete 'configure)
506 (add-before 'check 'start-xserver
507 ;; Tests require a running X server.
508 (lambda* (#:key inputs #:allow-other-keys)
509 (let ((xorg-server (assoc-ref inputs "xorg-server"))
510 (display ":1"))
511 (setenv "DISPLAY" display)
512 ;; Don't fail due to missing '/etc/machine-id'.
513 (setenv "DBUS_FATAL_WARNINGS" "0")
514 (zero? (system (string-append xorg-server "/bin/Xvfb "
515 display " &")))))))))
516 (home-page "https://pwmt.org/projects/zathura/")
517 (synopsis "Lightweight keyboard-driven PDF viewer")
518 (description "Zathura is a customizable document viewer. It provides a
519 minimalistic interface and an interface that mainly focuses on keyboard
520 interaction.")
521 (license license:zlib)))
522
523 (define-public podofo
524 (package
525 (name "podofo")
526 (version "0.9.5")
527 (source (origin
528 (method url-fetch)
529 (uri (string-append "mirror://sourceforge/podofo/podofo/" version
530 "/podofo-" version ".tar.gz"))
531 (sha256
532 (base32
533 "012kgfx5j5n6w4zkc1d290d2cwjk60jhzsjlr2x19g3yi75q2jc5"))))
534 (build-system cmake-build-system)
535 (inputs ; TODO: Add cppunit for tests
536 `(("lua" ,lua-5.1)
537 ("libpng" ,libpng)
538 ("openssl" ,openssl)
539 ("fontconfig" ,fontconfig)
540 ("libtiff" ,libtiff)
541 ("libjpeg" ,libjpeg-8)
542 ("freetype" ,freetype)
543 ("zlib" ,zlib)))
544 (arguments
545 `(#:configure-flags '("-DPODOFO_BUILD_SHARED=ON"
546 "-DPODOFO_BUILD_STATIC=ON")
547 #:phases
548 (modify-phases %standard-phases
549 (add-before 'configure 'patch
550 (lambda* (#:key inputs #:allow-other-keys)
551 (let ((freetype (assoc-ref inputs "freetype")))
552 ;; Look for freetype include files in the correct place.
553 (substitute* "cmake/modules/FindFREETYPE.cmake"
554 (("/usr/local") freetype)))
555 #t)))))
556 (home-page "http://podofo.sourceforge.net")
557 (synopsis "Tools to work with the PDF file format")
558 (description
559 "PoDoFo is a C++ library and set of command-line tools to work with the
560 PDF file format. It can parse PDF files and load them into memory, and makes
561 it easy to modify them and write the changes to disk. It is primarily useful
562 for applications that wish to do lower level manipulation of PDF, such as
563 extracting content or merging files.")
564 (license license:lgpl2.0+)))
565
566 (define-public mupdf
567 (package
568 (name "mupdf")
569 (version "1.12.0")
570 (source
571 (origin
572 (method url-fetch)
573 (uri (string-append "https://mupdf.com/downloads/archive/"
574 name "-" version "-source.tar.xz"))
575 (patches (search-patches "mupdf-build-with-latest-openjpeg.patch"
576 "mupdf-CVE-2017-17858.patch"))
577 (sha256
578 (base32
579 "0b9j0gqbc3jhmx87r6idcsh8lnb30840c3hyx6dk2gdjqqh3hysp"))
580 (modules '((guix build utils)))
581 (snippet '(delete-file-recursively "thirdparty"))))
582 (build-system gnu-build-system)
583 (inputs
584 `(("curl" ,curl)
585 ("freeglut" ,freeglut)
586 ("freetype" ,freetype)
587 ("harfbuzz" ,harfbuzz)
588 ("jbig2dec" ,jbig2dec)
589 ("libjpeg" ,libjpeg)
590 ("libx11" ,libx11)
591 ("libxext" ,libxext)
592 ("mujs" ,mujs)
593 ("openjpeg" ,openjpeg)
594 ("openssl" ,openssl)
595 ("zlib" ,zlib)))
596 (native-inputs
597 `(("pkg-config" ,pkg-config)))
598 (arguments
599 '(#:tests? #f ; no check target
600 #:make-flags (list "CC=gcc"
601 "XCFLAGS=-fpic"
602 (string-append "prefix=" (assoc-ref %outputs "out")))
603 #:phases (modify-phases %standard-phases
604 (delete 'configure))))
605 (home-page "https://mupdf.com")
606 (synopsis "Lightweight PDF viewer and toolkit")
607 (description
608 "MuPDF is a C library that implements a PDF and XPS parsing and
609 rendering engine. It is used primarily to render pages into bitmaps,
610 but also provides support for other operations such as searching and
611 listing the table of contents and hyperlinks.
612
613 The library ships with a rudimentary X11 viewer, and a set of command
614 line tools for batch rendering @command{pdfdraw}, rewriting files
615 @command{pdfclean}, and examining the file structure @command{pdfshow}.")
616 (license license:agpl3+)))
617
618 (define-public qpdf
619 (package
620 (name "qpdf")
621 (version "6.0.0")
622 (source (origin
623 (method url-fetch)
624 (uri (string-append "mirror://sourceforge/qpdf/qpdf/" version
625 "/qpdf-" version ".tar.gz"))
626 (sha256
627 (base32
628 "0csj2p2gkxrc0rk8ykymlsdgfas96vzf1dip3y1x7z1q9plwgzd9"))
629 (modules '((guix build utils)))
630 (snippet
631 ;; Replace shebang with the bi-lingual shell/Perl trick to remove
632 ;; dependency on Perl.
633 '(substitute* "qpdf/fix-qdf"
634 (("#!/usr/bin/env perl")
635 "\
636 eval '(exit $?0)' && eval 'exec perl -wS \"$0\" ${1+\"$@\"}'
637 & eval 'exec perl -wS \"$0\" $argv:q'
638 if 0;\n")))))
639 (build-system gnu-build-system)
640 (arguments
641 `(#:disallowed-references (,perl)
642 #:phases
643 (modify-phases %standard-phases
644 (add-before 'configure 'patch-paths
645 (lambda _
646 (substitute* "make/libtool.mk"
647 (("SHELL=/bin/bash")
648 (string-append "SHELL=" (which "bash"))))
649 (substitute* (append
650 '("qtest/bin/qtest-driver")
651 (find-files "." "\\.test"))
652 (("/usr/bin/env") (which "env"))))))))
653 (native-inputs
654 `(("pkg-config" ,pkg-config)
655 ("perl" ,perl)))
656 (propagated-inputs
657 `(("pcre" ,pcre)))
658 (inputs
659 `(("zlib" ,zlib)))
660 (synopsis "Command-line tools and library for transforming PDF files")
661 (description
662 "QPDF is a command-line program that does structural, content-preserving
663 transformations on PDF files. It could have been called something like
664 pdf-to-pdf. It includes support for merging and splitting PDFs and to
665 manipulate the list of pages in a PDF file. It is not a PDF viewer or a
666 program capable of converting PDF into other formats.")
667 (license license:clarified-artistic)
668 (home-page "http://qpdf.sourceforge.net/")))
669
670 (define-public xournal
671 (package
672 (name "xournal")
673 (version "0.4.8")
674 (source
675 (origin
676 (method url-fetch)
677 (uri (string-append "mirror://sourceforge/xournal/xournal/" version
678 "/xournal-" version ".tar.gz"))
679 (sha256
680 (base32
681 "0c7gjcqhygiyp0ypaipdaxgkbivg6q45vhsj8v5jsi9nh6iqff13"))))
682 (build-system gnu-build-system)
683 (inputs
684 `(("gtk" ,gtk+-2)
685 ("pango" ,pango)
686 ("poppler" ,poppler)
687 ("glib" ,glib)
688 ("libgnomecanvas" ,libgnomecanvas)))
689 (native-inputs
690 `(("pkg-config" ,pkg-config)))
691 (home-page "http://xournal.sourceforge.net/")
692 (synopsis "Notetaking using a stylus")
693 (description
694 "Xournal is an application for notetaking, sketching, keeping a journal
695 using a stylus.")
696 (license license:gpl2+)))
697
698 (define-public python-reportlab
699 (package
700 (name "python-reportlab")
701 (version "3.4.0")
702 (source (origin
703 (method url-fetch)
704 (uri (pypi-uri "reportlab" version))
705 (sha256
706 (base32
707 "0hy304pzsz9lblmk7mrbk2682bi911lxgvzx2kcfpmfzb5gg7sjv"))))
708 (build-system python-build-system)
709 (arguments
710 '(;; FIXME: There is one test failure, but it does not cause the
711 ;; build to fail. No time to investigate right now.
712 #:test-target "tests"))
713 (propagated-inputs
714 `(("python-pillow" ,python-pillow)))
715 (home-page "https://www.reportlab.com")
716 (synopsis "Python library for generating PDFs and graphics")
717 (description "This is the ReportLab PDF Toolkit. It allows rapid creation
718 of rich PDF documents, and also creation of charts in a variety of bitmap and
719 vector formats.")
720 (license license:bsd-3)))
721
722 (define-public python2-reportlab
723 (package-with-python2 python-reportlab))
724
725 (define-public impressive
726 (package
727 (name "impressive")
728 (version "0.11.1")
729 (source (origin
730 (method url-fetch)
731 (uri (string-append
732 "mirror://sourceforge/impressive/Impressive/"
733 version "/Impressive-" version ".tar.gz"))
734 (sha256
735 (base32
736 "0b3rmy6acp2vmf5nill3aknxvr9a5aawk1vnphkah61anxp62gsr"))))
737 (build-system python-build-system)
738
739 ;; TODO: Add dependency on pdftk.
740 (inputs `(("python2-pygame" ,python2-pygame)
741 ("python2-pillow" ,python2-pillow)
742 ("sdl" ,sdl)
743 ("xpdf" ,xpdf)))
744
745 (arguments
746 `(#:python ,python-2
747 #:phases (modify-phases %standard-phases
748 (delete 'build)
749 (delete 'configure)
750 (delete 'check)
751 (replace 'install
752 (lambda* (#:key inputs outputs #:allow-other-keys)
753 ;; There's no 'setup.py' so install things manually.
754 (let* ((out (assoc-ref outputs "out"))
755 (bin (string-append out "/bin"))
756 (man1 (string-append out "/share/man/man1"))
757 (sdl (assoc-ref inputs "sdl"))
758 (xpdf (assoc-ref inputs "xpdf")))
759 (mkdir-p bin)
760 (copy-file "impressive.py"
761 (string-append bin "/impressive"))
762 (wrap-program (string-append bin "/impressive")
763 `("LIBRARY_PATH" ":" prefix ;for ctypes
764 (,(string-append sdl "/lib")))
765 `("PATH" ":" prefix ;for pdftoppm
766 (,(string-append xpdf "/bin"))))
767 (install-file "impressive.1" man1)
768 #t))))))
769 (home-page "http://impressive.sourceforge.net")
770 (synopsis "PDF presentation tool with visual effects")
771 (description
772 "Impressive is a tool to display PDF files that provides visual effects
773 such as smooth alpha-blended slide transitions. It provides additional tools
774 such as zooming, highlighting an area of the screen, and a tool to navigate
775 the PDF pages.")
776 (license license:gpl2)))
777
778 (define-public fbida
779 (package
780 (name "fbida")
781 (version "2.12")
782 (home-page "https://www.kraxel.org/blog/linux/fbida/")
783 (source (origin
784 (method url-fetch)
785 (uri (string-append "https://www.kraxel.org/releases/fbida/"
786 name "-" version ".tar.gz"))
787 (sha256
788 (base32
789 "0bw224vb7jh0lrqaf4jgxk48xglvxs674qcpj5y0axyfbh896cfk"))))
790 (build-system gnu-build-system)
791 (arguments
792 '(#:phases
793 (modify-phases %standard-phases
794 (add-after 'unpack 'patch-ldconfig
795 (lambda _
796 (substitute* "mk/Autoconf.mk"
797 (("/sbin/ldconfig -p") "echo lib")) #t))
798 (delete 'configure))
799 #:tests? #f
800 #:make-flags (list "CC=gcc"
801 (string-append "prefix=" (assoc-ref %outputs "out")))))
802 (inputs `(("libjpeg" ,libjpeg)
803 ("curl" ,curl)
804 ("libtiff" ,libtiff)
805 ("libudev" ,eudev)
806 ("libwebp" ,libwebp)
807 ("libdrm" ,libdrm)
808 ("imagemagick" ,imagemagick)
809 ("giflib" ,giflib)
810 ("glib" ,glib)
811 ("cairo-xcb" ,cairo-xcb)
812 ("freetype" ,freetype)
813 ("fontconfig" ,fontconfig)
814 ("libexif" ,libexif)
815 ("mesa" ,mesa)
816 ("libepoxy" ,libepoxy)
817 ("libpng" ,libpng)
818 ("poppler" ,poppler)))
819 (native-inputs `(("pkg-config" ,pkg-config)))
820 (synopsis "Framebuffer and drm-based image viewer")
821 (description
822 "fbida contains a few applications for viewing and editing images on
823 the framebuffer.")
824
825 (license license:gpl2+)))
826
827 (define-public pdf2svg
828 (package
829 (name "pdf2svg")
830 (version "0.2.3")
831 (source (origin
832 (method url-fetch)
833 (uri (string-append
834 "https://github.com/dawbarton/pdf2svg/archive/v"
835 version ".tar.gz"))
836 (file-name (string-append name "-" version ".tar.gz"))
837 (sha256
838 (base32
839 "12pa1pajirnlrkz2il3h4l30lc2prryk1qr132jk6z9y1c3qdcag"))))
840 (build-system gnu-build-system)
841 (inputs
842 `(("cairo" ,cairo)
843 ("poppler" ,poppler)))
844 (native-inputs
845 `(("pkg-config" ,pkg-config)))
846 (home-page "http://www.cityinthesky.co.uk/opensource/pdf2svg/")
847 (synopsis "PDF to SVG converter")
848 (description "@command{pdf2svg} is a simple command-line PDF to SVG
849 converter using the Poppler and Cairo libraries.")
850 (license license:gpl2+)))
851
852 (define-public python-pypdf2
853 (package
854 (name "python-pypdf2")
855 (version "1.26.0")
856 (source (origin
857 (method url-fetch)
858 (uri (pypi-uri "PyPDF2" version))
859 (sha256
860 (base32
861 "11a3aqljg4sawjijkvzhs3irpw0y67zivqpbjpm065ha5wpr13z2"))))
862 (build-system python-build-system)
863 (arguments
864 `(#:phases
865 (modify-phases %standard-phases
866 (add-after
867 'unpack 'patch-test-suite
868 (lambda _
869 ;; The text-file needs to be opened in binary mode for Python 3,
870 ;; so patch in the "b"
871 (substitute* "Tests/tests.py"
872 (("pdftext_file = open\\(.* 'crazyones.txt'\\), 'r" line)
873 (string-append line "b")))
874 #t))
875 (replace 'check
876 (lambda _
877 (zero? (system* "python" "-m" "unittest" "Tests.tests")))))))
878 (home-page "http://mstamy2.github.com/PyPDF2")
879 (synopsis "Pure Python PDF toolkit")
880 (description "PyPDF2 is a pure Python PDF library capable of:
881
882 @enumerate
883 @item extracting document information (title, author, …)
884 @item splitting documents page by page
885 @item merging documents page by page
886 @item cropping pages
887 @item merging multiple pages into a single page
888 @item encrypting and decrypting PDF files
889 @end enumerate
890
891 By being pure Python, it should run on any Python platform without any
892 dependencies on external libraries. It can also work entirely on
893 @code{StringIO} objects rather than file streams, allowing for PDF
894 manipulation in memory. It is therefore a useful tool for websites that
895 manage or manipulate PDFs.")
896 (license license:bsd-3)))
897
898 (define-public python2-pypdf2
899 (package-with-python2 python-pypdf2))
900
901 (define-public python2-pypdf
902 (package
903 (name "python2-pypdf")
904 (version "1.13")
905 (source (origin
906 (method url-fetch)
907 (uri (pypi-uri "pyPdf" version))
908 (sha256
909 (base32
910 "0fqfvamir7k41w84c73rghzkiv891gdr17q5iz4hgbf6r71y9v9s"))))
911 (build-system python-build-system)
912 (arguments
913 `(#:tests? #f ; no tests
914 #:python ,python-2))
915 (home-page "http://pybrary.net/pyPdf/")
916 (synopsis "Pure Python PDF toolkit")
917 (description "PyPDF2 is a pure Python PDF toolkit.
918
919 Note: This module isn't maintained anymore. For new projects please use
920 python-pypdf2 instead.")
921 (license license:bsd-3)))
922
923 (define-public pdfposter
924 (package
925 (name "pdfposter")
926 (version "0.6.0")
927 (source (origin
928 (method url-fetch)
929 (uri (pypi-uri "pdftools.pdfposter" version ".tar.bz2"))
930 (sha256
931 (base32
932 "1i9jqawf279va089ykicglcq4zlsnwgcnsdzaa8vnm836lqhywma"))))
933 (build-system python-build-system)
934 (arguments
935 `(#:tests? #f ; no test suite, only for visual control
936 #:python ,python-2))
937 (inputs
938 ;; pdfposter 0.6.0 still uses the old pyPdf
939 `(("python2-pypdf" ,python2-pypdf)))
940 (home-page "https://pythonhosted.org/pdftools.pdfposter/")
941 (synopsis "Scale and tile PDF images/pages to print on multiple pages")
942 (description "@command{pdfposter} can be used to create a large poster by
943 building it from multple pages and/or printing it on large media. It expects
944 as input a PDF file, normally printing on a single page. The output is again
945 a PDF file, maybe containing multiple pages together building the poster. The
946 input page will be scaled to obtain the desired size.
947
948 This is much like @command{poster} does for Postscript files, but working with
949 PDF. Since sometimes @command{poster} does not like your files converted from
950 PDF. Indeed @command{pdfposter} was inspired by @command{poster}.")
951 (license license:gpl3+)))
952
953 (define-public pdfgrep
954 (package
955 (name "pdfgrep")
956 (version "2.0.1")
957 (source
958 (origin
959 (method url-fetch)
960 (uri (string-append "https://pdfgrep.org/download/"
961 name "-" version ".tar.gz"))
962 (sha256
963 (base32
964 "07llkrkcfjwd3ybai9ad10ybhr0biffcplmy7lw4fb87nd2dfw03"))))
965 (build-system gnu-build-system)
966 (native-inputs
967 `(("pkg-config" ,pkg-config)))
968 (inputs
969 `(("libgcrypt" ,libgcrypt)
970 ("pcre" ,pcre)
971 ("poppler" ,poppler)))
972 (home-page "https://pdfgrep.org")
973 (synopsis "Command-line utility to search text in PDF files")
974 (description
975 "Pdfgrep searches in pdf files for strings matching a regular expression.
976 Support some GNU grep options as file name output, page number output,
977 optional case insensitivity, count occurrences, color highlights and search in
978 multiple files.")
979 (license license:gpl2+)))