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