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