I\'ve been using PDFTK
Server on OSX pre 10.11
for over a year without any issues running commands on the command line.
After installing OS
work for me install the new one, https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk_server-2.02-mac_osx-10.11-setup.pkg
remove the old pdftk version; search the pdftk from the finder, move to trash and also have pdftk_uninstall.sh done.
$ pdftk -version
pdftk 2.02 a Handy Tool for Manipulating PDF Documents Copyright (c) 2003-13 Steward and Lee, LLC - Please Visit: www.pdftk.com This is free software; see the source code for copying conditions. There is NO warranty, not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Third Edit: The following are not fixes, but rather workarounds, (`cuz sometimes its not feasible to wait months for fixes to arrive).
Second Edit: Coherent PDF Command Line Tools (aka cpdf
) is free for noncommercial use, and can be licensed for commercial use. It provides functionality comparable to pdtk
and (on my MacBook Pro at least) seems to run OK under El Capitan.
Edit: This StackOverflow answer tells how to use ghostscript
to concatenate files, thus providing (awkwardly) functionality similar to of "pdftk ... cat output out.pdf"
.
For some purposes, the package ghostscript
---which ships with LaTeX distributions like texlive
---offers similar (but less user-friendly) capability to pdftk
.
E.g., to extract pages 6-7 from a multipage pdf document:
gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER \
-dFirstPage=6 -dLastPage=7 \
"-sOutputFile="${EXTRACTED_FILENAME_HERE}" \
"${SOURCE_FILENAME_HERE}" ;
The above worked for me ... your mileage may vary!
Needless to say, restoring pdftk
to full functionality under El Capitan would be much better ... pdftk
really is a terrific utility.
Pdftk is currently not working for me on OSX Sierra.
If you have docker installed on your system, you can use my lightweight docker image instead:
$ docker run -v $(pwd):/files alpine-pdftk --help
Even better, simply use the following script as a drop in replacement:
#!/usr/bin/env bash
docker run --rm -v $(pwd):/files jottr/alpine-pdftk "$@"
Now you can use pdftk as expected: ./pdftk --help
You can get to a running PDFTK Server under El Capitan if you use the manual of patching ports together with the four patches provided in Macports tickets #48528 and #49227.
The compilation of patched GCC5 took a long time on my machine. Also, it seems to be a good idea to name the local ports identically to the original ones (i.e. gcc5 and pdftk), otherwise you have to adjust the Portfiles.
It is also possible to bundle the resulting pdftk binary together with its dynamic libraries using install_name_tool on the binary and the dynamic libraries. I succeeded to run pdftk this way on two other machines.