关于macos:OS X 10.11上的PDFtk Server

PDFtk Server on OS X 10.11

我在OSX pre 10.11上使用PDFTK服务器已有一年多了,在命令行上运行命令没有任何问题。

安装OSX 10.11 Beta后,我不能再在命令行上运行任何PDFTK Server命令。它不会引发任何错误,我尝试执行的所有命令都会无限期地挂起。

我始终从从PDFTK服务器网站下载的pkg安装:

https://www.pdflabs.com/tools/pdftk-server/

我也尝试过使用Homebrew从源代码安装。安装有效,但得到的结果相同,命令仅挂在终端上:

自制水龙头

我已经通过他们的"反馈助手"应用程序将投诉发送给了Apple,该应用程序在两个月前安装Beta时安装,但没有任何回复。

有人告诉我有关Apple反馈助手的信息:

You likely won't ever receive a response. Apple only replies through
Feedback Assistant for major bugs of the operating system where they
need additional information. It is not a way to obtain support, even
less so for a third-party application.

我也联系了包装制造商PDF Labs,但没有回应。

在MacPorts上,他们在OS X 10.11上的构建存在问题,这是否意味着在软件级别上与PDFtk和10.11存在兼容性问题?

我在网上搜索了有关可能导致该问题的原因以及如何解决该问题的线索,但没有发现任何实质性的信息。

在OS X上,我不知道如何解决升级后现在是否存在权限或路径甚至Java问题。

任何帮助您排除根本原因或提供修复的帮助都将受到赞赏。

更新1:

我在PDF实验室收到Sid Steward的回音:

We have been wrestling with this almost as long as the beta has been
out. We are still working on it. There appears to be an
incompatibility with one of the (non-Apple) libraries that pdftk uses
and OS X 10.11. Presently I am installing yet another update to
Apple's developer tools with the hope that it will solve the problem.
I will update you with our progress.

更新2:

PDF Labs的Sid Steward再次:

It looks like there are two threads running under pdftk, and that they
are deadlocked. That means that each thread is waiting for the other
to finish. I'm not an expert here, but that's my impression. Here is a
screenshot from Mac's Activity Monitor to illustrate:

enter image description here

The above snapshot is from trying to run the pdftk binary currently on
our site on OS X 10.11. The libgcj library noted above comes with
pdftk, where the others are OS X libraries.

As I say, I just installed Xcode 7.0.1, which was released yesterday
on the App store. I will now attempt to use these tools to build
pdftk.

更新3:

MacPorts正在处理PDFtk的生成问题,这是该线程的更新(注意:这与PDFtk Labs无关):

This is due to the recompilation of libunwind in 10.11 using Apple
Clang 7 producing new valid optimizations (according to Apple) that
tickle an unknown bug in FSF boehm-gc.

?https://gcc.gnu.org/bugzilla/show_bug.cgi?id = 66848

Don't expect any fixes from Apple as they can't touch the GPLv3 code
to look at the FSF boehm-gc problem (unless they used the gcc43
package which should still be GPLv2). That this issue is triggered by
the recompilation of libunwind is demonstrated by that fact that
substituting the libunwind.dylib from 10.10 eliminates both the
boehm-gc and gcj failures.

Note that is was filed as radr://21372179,"the FSF boehm-gc library
built on 10.10 fails to pass its tests on 10.11" but closed as being
an FSF boehm-gc bug.

更新4:

MacPorts找到了一种解决构建问题的方法,这是该线程的更新

The attached Portfile.diff (when used with the proposed gcc5 update on
#49227 which fixes gcj) solves the build issue with pdftk.

更新5:

PDF Labs的Sid Steward已成功构建,他的反馈是:

A fix for MacPorts gcc5 allowed me to build a working pdftk that
merges PDFs on El Capitan. The fix was added to the ticket you had
posted to:

MacPorts

I will proceed to fully test this pdftk before packing it up into an
installer. This process could take a couple days.


感谢您的耐心等待。我已经在OS X 10.11 El Capitan上成功测试了该pdftk安装程序和二进制文件:

https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk_server-2.02-mac_osx-10.11-setup.pkg

我将尽快更新我们的PDF Labs网站以反映此更新。

如果您已经从旧的安装程序中安装了pdftk,则应在没有问题的情况下直接在其顶部安装-在安装此pdftk之前,不必删除它。

请注意,尚未在较旧版本的OS X上测试此安装程序/二进制文件。

请让我知道它如何为您工作。

我要感谢Aaron打开此线程,并对我们使用构建工具遇到的问题给予了有帮助的关注。我还要感谢MacPorts团队的专业及时的工作!

最好的祝福-

Sid Steward,PDF实验室


感谢github.com/quantiverge,pdftk应该可以在brew下安装。这是在OSX Sierra中测试过的。

在终端中运行以下命令。

1
brew install https://raw.githubusercontent.com/turforlag/homebrew-cervezas/master/pdftk.rb


Pdftk目前无法在OSX Sierra上为我工作。

如果您的系统上安装了docker,则可以改用我的轻量级docker映像:

1
$ docker run -v $(pwd):/files alpine-pdftk --help

更好的是,只需使用以下脚本代替替换:

1
2
#!/usr/bin/env bash
docker run --rm -v $(pwd):/files jottr/alpine-pdftk"$@"

现在您可以按预期使用pdftk:./pdftk --help


为我工作安装新的https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk_server-2.02-mac_osx-10.11-setup.pkg

删除旧的pdftk版本;
从查找程序中搜索pdftk,移至垃圾桶,并完成pdftk_uninstall.sh。

1
$ pdftk -version

pdftk 2.02用于处理PDF文档的便捷工具
版权所有(c)2003-13 Steward and Lee,LLC-请访问:www.pdftk.com
这是免费软件;请参阅源代码以了解复制条件。有
没有保证,甚至没有适销性或特定目的的适用性。


@Learner我在这里修改了食谱:https://github.com/zph/homebrew-cervezas/blob/master/pdftk.rb并向您链接的回购提交了PR。

在合并之前,您可以:

1
brew install https://github.com/zph/homebrew-cervezas/blob/master/pdftk.rb

截至2018-05-09的更新状态:

  • 不在冲泡标准来源上
  • https://github.com/spl/homebrew-pdftk已维护/已弃用
  • 它位于https://www.pdflabs.com/tools/pdftk-server/

  • 如果您使用修补端口的手册以及Macports票证#48528和#49227中提供的四个补丁程序,则可以进入El Capitan下正在运行的PDFTK服务器。

    修补过的GCC5的编译在我的计算机上花费了很长时间。另外,将本地端口命名为与原始端口相同(例如gcc5和pdftk)似乎是个好主意,否则您必须调整Portfiles。

    也可以使用install_name_tool将生成的pdftk二进制文件及其动态库捆绑在一起
    关于二进制文件和动态库。我成功在其他两台计算机上以这种方式运行pdftk。


    解决方法:
    我们在8月份将其提交给Sid,但他仍未修复它,因此我可以公平地说这是寻找替代方案的好主意。因此,我们已主动提交了一些人们可以在以下存储库中免费使用的第一个工具:

    https://github.com/flexpaper/OSX-PDF-Toolkit

    它包含用于CAT和BURST的易于使用的脚本。我们打算继续增加更多的工具。随时贡献

    这些新工具正在使用本机OSX库,并且不需要任何第三方依赖项。好极了!

    编辑:添加了有关此解决方法的信息


    第三修改:以下内容不是修复程序,而是解决方法(`cuz有时等待几个月的修复程序才能实现)。

    第二次编辑:相干PDF命令行工具(又名cpdf)对于非商业用途是免费的,并且可以许可用于商业用途。它提供的功能可与pdtk媲美,并且(至少在我的MacBook Pro上)在El Capitan下运行正常。

    编辑:此StackOverflow答案说明如何使用ghostscript串联文件,从而提供(笨拙的)类似于"pdftk ... cat output out.pdf"的功能。

    出于某些目的,软件包ghostscript-(与texlive-等LaTeX发行版一起提供)提供了与pdftk类似(但不太友好)的功能。

    例如,要从多页pdf文档中提取6-7页:

    1
    2
    3
    4
    gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER \
      -dFirstPage=6 -dLastPage=7 \
     "-sOutputFile="${EXTRACTED_FILENAME_HERE}" \
     "${SOURCE_FILENAME_HERE}" ;

    以上为我工作...您的里程可能会有所不同!

    不用说,在El Capitan下将pdftk恢复为完整功能会更好。... pdftk确实是一个了不起的实用程序。


    2019更新

    工作:

    请注意,为了将其安装在macOS High Sierra(10.13.5)上,我必须从以下位置下载软件包:

    https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk_server-2.02-mac_osx-10.11-setup.pkg

    当然,由于它不是从" App Store"下载的,因此无法正常安装,因此请按照以下说明进行操作:

  • 在Finder中,找到您要打开的应用。

  • 请勿使用启动板执行此操作。启动板不允许您访问快捷菜单。

  • 按住Control键并单击该应用程序图标,然后从快捷菜单中选择"打开"。

  • 单击打开。

  • 该应用程序被保存为安全设置的例外,以后您可以像双击任何已注册的应用程序一样双击该应用程序以将其打开。

  • 之后,只需完成安装过程即可,几乎就是NEXT-NEXT并享受:)

    不工作:

    以下Brew命令DID对我不起作用:

    1
    brew install https://raw.githubusercontent.com/turforlag/homebrew-cervezas/master/pdftk.rb

    它给出了以下错误:

    Failure while executing; /usr/bin/xar -xf
    /xxxx/Library/Caches/Homebrew/downloads/\#\{url_sha256\}--\*
    exited
    with 1.

    祝好运!