Pdftk

0 views
Skip to first unread message

Valorie Carlee

unread,
Aug 3, 2024, 1:55:08 PM8/3/24
to rartentlele

Basically the process is opening and installing the .deb files - preferably on gdebi - in the order below. It might be interesting to open pdftk first on gdebi just to see the "impossible dependency" warning. We're basically installing the dependencies from an older repository, so it'll run like it did in 17.10. The order is:

I need to do some batch operations on PDF files and every StackExchange answer to questions similar to mine involves pdftk. But with dnf I get no matches for dnf search pdftk, no matches for dnf provides pdftk, and the only Fedora-specific question about it that I could find was referencing Fedora Core 6.

Pdftk was retired from Fedora 6 years ago. There is Stapler (in package pdf-stapler), which is a pdftk replacement written in Python. Alternatively, there was an article in Fedora Magazine discussing pdf modification tools, maybe one of those will suit your needs as well.

with php i have to split a single pdf file with multiple pages inside it to a lot of PDF file with one page per file.I use pdftk and works fine, but every pdf created for every page is very large size. My original PDF is 7MB (with 70pages inside), the sum of every file created by splitting with pdftk is over 70MB.

Note that pdftk just copies the content of your PDF files from the inputs into the outputs, and can't do very much to optimize away bloat. So if your input PDFs are large/complicated, your output PDFs will be also. Also note that any fonts embedded in the document may end up being duplicated in each output document, taking up more space.

The only differences that I can quickly see with other generated files is that page format as been changed and replaced by an A4 page AND that can only be done manually using Print GUI of PDF program as Acrobat Reader or Foxit Reader.

I had a similar problem and I've tried many different tools and I realized that, even if sometimes the compression of the original file doesn't seem to work, the outcome of the split (or burst) can be heavily reduced after using some of them. The solution that worked better for me was the combination of these two steps:

Compress your original file with pdf2go (basic compression worked for me). It also worked printing it to a new file with evince, as suggested in another answer, but it worked worse in my example. The size of the file may not be reduced at all (in my case it even increased) but still the output files after burst are much smaller.

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.

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.

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:

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.

I want to thank Aaron for opening this thread and for bringing helpful attention to the problem we were having with the build tools. I also want to thank the MacPorts team for their professional and timely work!

pdftk 2.02 a Handy Tool for Manipulating PDF DocumentsCopyright (c) 2003-13 Steward and Lee, LLC - Please Visit: www.pdftk.comThis is free software; see the source code for copying conditions. There isNO warranty, not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

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.

Workarounds:We raised this to Sid back in August and he still has not fixed it so I think its fair to say that its a good idea to look for alternatives. Because of this, we have taken the initiative to submit a few first tools that people can enjoy for free in the following repository:

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.

AFIK the best maintained Homebrew cask formula to download, extract and manually install the binary build of pdftk 2.02 provided by Sid Steward in 2015 for OSX 10.11 compatibilty (which is still not publically announced) is the one from zph. brew install zph/cervezas/pdftk still works on recent OS and (using Rosetta 2) on ARM64.

However, in the meantime a plain Java fork/port of the original GPL sources were created that is actively maintained. This does no longer depend on the GCJ compiler and is called pdftk-java. While this depends on an jdk to be installed, the upstream homebrew provides again a regular formula for all supported OS and architectures. So a simple brew install pdftk-java should install a drop-in replacement of the original pdftk.

Or maybe other solutions to compress my file? It is heavy because some graphics have a lot of points. Is there a way to convert these graphs to jpg for instance and adapt the compression?

Edit: I just discovered another option (for lossless compression), which avoids the nasty gs command. qpdf is a neat tool that converts PDFs (compression/decompression, encryption/decryption), and is much faster than the gs command:

Trying to compress a PDF I made with 400ppi tiffs, mostly 8-bit, a few 24-bit, with PackBits compression, using tiff2pdf compressed with Zip/Deflate. One problem I had with every one of these methods: none of the above methods preserved the bookmarks TOC that I painstakingly manually created in Acrobat Pro X. Not even the recommended ebook setting for gs. Sure, I could just open a copy of the original with the TOC intact and do a Replace pages but unfortunately, none of these methods did a satisfactory job to begin with. Either they reduced the size so much that the quality was unacceptably pixellated, or they didn't reduce the size at all and in one case actually increased it despite quality loss.

Adjust the value of the -dColorImageResolution option to achieve a result that fits your needs (the value describes the image resolution in DPIs). If your input file is in grayscale, replacing Color through Gray or using both options in the above command could also help. Further fine-tuning is possible by changing the -dPDFSETTINGS option to /default or /printer. For explanations of the all possible options consult the ps2pdf manual.

The one-line pdf2ps option (by Lee) actually increased the pdf size. However, the two steps one did better. And it can be combined in a single one using redirection from & to standard input/output and pipes:

I discovered this by opening a pdf with Evince in Gnome and then printing to file. This resulted in better file compression and better file quality compared to all the other answers for my pdf file. It seems cairo graphics is used in the background when printing to a file this way: running pdfinfo on the resulting file reveals

I just turned a 140MB PDF produced with Keynote into 2.8Mb using Okular's Print to PDF. Text was converted to raster and zooming-in too much cleary shows pixels, but images were kept pretty sharp and its useable for messaging apps.

In case you want to compress a PDF which contains a lot of selectable text, on Windows you can use NicePDF Compressor - choose "Flate" option.After trying everything (cpdf, pdftk, gs) it finally helped me to compress my 1360 pages PDF from 500 MB down to 10 MB.

I want to use pdftk but I always get this error zsh: bad CPU type in executable: pdftk I reinstalled pdftk and I changed the terminal from bsh to zsh as I found in my search for how to solve this error but without any success. I'm using the latest MacOS version "Catalina v10.15.4"

As a preliminary solution, I was successful in installing the Intel version of homebrew in /usr/local (in parallel to the M1 version in /opt/homebrew) using Apple's Rosetta 2 layer. The Intel packages (homebrew formulae) seem to work without any problem on the Apple M1 architecture. Both pdftk and pandoc work even without prefixing 'arch -x86_64' (e.g., the command 'pandoc sample.md -o sample.html' as in the example linked below).

Search in specific suite:[focal][focal-updates][focal-backports][jammy][jammy-updates][jammy-backports][mantic][mantic-updates][mantic-backports][noble][noble-updates][noble-backports][oracular]Limit search to a specific architecture: [i386] [amd64] [powerpc] [arm64] [armhf] [ppc64el] [riscv64] [s390x] You have searched for packages that names contain pdftk in all suites, all sections, and all architectures.Found 2 matching packages.

I am having trouble with pdftk on my Mac OS X 10.11 and want to remove all traces of it from my system before attempting to make a new install with the newest package 2.02 (available here on StackOverflow) which I already installed.

I do not know how to uninstall the default pdftk, but the pdftk binary in /opt/pdflabs/pdftk/bin/pdftk seems to use by default the correct libraries. So in the meantime you could just change your PATH (in .bashrc / .bash_profile) so that the pdftk you use by default if the good one with something like

c80f0f1006
Reply all
Reply to author
Forward
0 new messages