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