Questions tagged [pdftk]

A simple, GPL-licensed command-line tool for manipulating PDF documents.

Project homepage

Pdftk allows you to manipulate PDF easily and freely. It does not require Acrobat, and it runs on Windows, Linux, Mac OS X, FreeBSD and Solaris.

Pdftk can

  • Merge PDF Documents
  • Split PDF Pages into a New Document
  • Rotate PDF Pages or Documents
  • Decrypt Input as Necessary (Password Required)
  • Encrypt Output as Desired
  • Fill PDF Forms with FDF Data or XFDF Data and/or Flatten Forms
  • Apply a Background Watermark or a Foreground Stamp
  • Report on PDF Metrics such as Metadata, Bookmarks, and Page Labels
  • Update PDF Metadata
  • Attach Files to PDF Pages or the PDF Document
  • Unpack PDF Attachments
  • Burst a PDF Document into Single Pages
  • Uncompress and Re-Compress Page Streams
  • Repair Corrupted PDF (Where Possible)
510 questions
1
vote
1 answer

SafeShell::CommandFailedException: in pdftk

I am getting SafeShell::CommandFailedException: Shell command ["/opt/homebrew/bin/pdftk" error while executing pdftk.fill_form 'public/data.pdf', pdf_name_with_path, data, :flatten => true Earlier it was working when i was using pdftk, now i just…
Chakreshwar Sharma
  • 2,571
  • 1
  • 11
  • 35
1
vote
0 answers

Pdftk not working with Laravel on shared hosting

I am working on a project that needs a pdf form populated from a database my project is to develop on Laravel 9 and for pdf fill using mikehaertl/php-pdftk and this website is live on shared hosting. I am getting this error and am not able to solve…
MShoaib
  • 15
  • 1
  • 6
1
vote
0 answers

Can I pass PDF data held in PHP variable to exec with PDFtk?

I am trying to run PDFtk using PHP exec. It worked fine with files that had physical locations. Is it possible to run exec if pdf data file is held in variable or does exec only work with files with physical locations? Below is my code. The first…
TWolfe
  • 7
  • 3
1
vote
0 answers

Details about "Number of Input pdf" or "Input PDF Character Len"

I'm using pdftk within my application to generate a composite pdf of several individual pdf files. When, for whatever reason, pdftk does run. If feel that the reason is the amount of Input files e.g. 586 or the Character Length of Input pdf files -…
EWProg
  • 11
  • 2
1
vote
1 answer

Automatic merging of one page pdfs to two page pdfs

I know there are tools like pdftk or convert or ghostscript. but my searches failing because all of the solutions are build for 2 pdf-files merged into 1 pdf-file. But I have 30.000 PDF files and want to merge them down to 15.000 two sided PDF…
samsy
  • 11
  • 1
1
vote
0 answers

Is there a way to catenate specific pages from multiple pdfs using pdftk?

So say I have a few pdfs with. Some with a single page, some with 3, 4, 5 and so on… I want to extract say the 4th page from the pdfs (ignoring ones without the 4th) page and merge them into a single pdf. Tried something like $ pdftk *.pdf cat 4…
Fraz
  • 11
  • 2
1
vote
2 answers

pdftk update_info command raising a warning which I don't understand

I'm trying to use the update_info command in order to add some bookmarks to an existing pdf's metadata using pdftk and powershell. I first dump the metadata into a file as follows: pdftk .\test.pdf dump_data > test.info Then, I edit the test.info…
user32882
  • 5,094
  • 5
  • 43
  • 82
1
vote
2 answers

Path Problems (command line)

I have created a script with an array containing file names. The script searches for pdf files through directories and sub-directories by recursion and adds them to an array. It then outputs a string into the command line for pdftk so as to merge…
Brian
  • 1,951
  • 16
  • 56
  • 101
1
vote
0 answers

Predicting file size of output file when merging PDFs (using GhostScript or similar)

This is what I am trying to achieve: I got several hundred small PDF files of varying size. I need to merge them into chunks of close to but no more than a certain target file size. I am familiar with gs as well as pdftk (though i prefer to use…
jschpmr
  • 98
  • 5
1
vote
1 answer

Laradock install PDFtk

I'm trying to install pdftk for laradock (php-fpm and workspace), but pdftk is not found for Ubuntu 20.04. So I try to create a new container, but I don't know how to call it from other containers, like php-fpm and workspace. # Dockerfile FROM…
alvaro.canepa
  • 562
  • 3
  • 13
1
vote
0 answers

merging multiple pdf files into one per file name using PDFtk pro

I have a situation that I need to merge files again by file names. Now, I have files in one folder like this - A1.pdf, A2.pdf, B1.pdf, C1.pdf, C2.pdf, C3.pdf. The goal is to merge files by file names and I will get A.pdf, B.pdf, C.pdf. I tried…
1
vote
2 answers

How do I pipe pdf-generating output through pdftk to remove annotations?

I want to pipe pdf-generating output through pdftk to remove annotations. How can I combine this existing portion of a working AppleScript line: do shell script "/usr/local/bin/$pdf-generating-app --page-size=A4 --page-margin=5mm " & (quoted form of…
John
  • 49
  • 6
1
vote
1 answer

Bad CPU type in executable on mac

I have installed pdftk on my mac and when i try to check the version by the command pdftk -verison -bash: /usr/local/bin/pdftk: Bad CPU type in executable how can i fix this?
Madhan
  • 79
  • 10
1
vote
0 answers

In xampp 1.7.4 pdftk doesnt work it gives UNLINK error

In my previous version of xampp pdftk was working fine ... later when i upgraded it xampp 1.7.4... the pdftk is not working in this version ... how to overcome this problem without downgrading my xampp version
user813995
  • 7
  • 1
  • 4
1
vote
1 answer

"non-zero exit status 1" due to pdf file not found when using pypdftk to fill pdf forms in Django project in virtual env on dev server in Windows

The following python code successfully fills out a pdf form: import pypdftk data_dict = {key:value pairs} PDF_PATH = 'form.pdf' #form to be filled out in same folder as the file executing this code out_file = 'out_file.pdf' …
justajolt
  • 141
  • 11