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
3
votes
1 answer

PHPExcel create/style/save PDF Documentation

I'm using the PHPExcel library in a couple of project and love the functionality it provides. Currently I needed to save as a PDF and found that PHPExcel can do this but I'm finding it rather hard to track down some examples or documentation on the…
Phill Pafford
  • 83,471
  • 91
  • 263
  • 383
3
votes
1 answer

How can you specify the description of the attachment with `pdftk`?

In the documentation of PDFTK is not mentioned how to do it. The command: pdftk file.pdf attach_files attachDoc.pdf to_page 2 output - will attach a file to page 2 of the original file.pdf and output the result to . attachDoc.pdf is the…
Marinov
  • 31
  • 3
3
votes
1 answer

Fill a PDF form with default data

I am working on editing a PDF form/template in Ruby On Rails application. I want to populate some of form fields with data from database and make few fields editable to take the input from user. I found PDFtf but I read that this is very old…
Chakreshwar Sharma
  • 2,571
  • 1
  • 11
  • 35
3
votes
1 answer

I am trying to install pdftk server on elastic bean stack using .ebextension configuration but not able to install

I am trying to install pdftk server on elastic bean stack using .ebextension configuration but not able to install. I am trying the below config file in the .ebextension folder. Please help me # Install PDFtk 01_wget_pdftk: command: "sudo wget…
3
votes
3 answers

is this the right php header for pdftk

I'm writing a very basic catenation script and lifted this straight off the pdftk 0.10.0 packagist site: use mikehaertl\pdftk\Pdf; // Extract pages 1-2 into a new file $pdf = new Pdf('sourcefile.pdf'); $result = $pdf->cat(1, 2) …
andreithegiant
  • 215
  • 1
  • 10
3
votes
0 answers

How to add a cover to a pdf file from an image and from a bash command line?

Given an image and a pdf file, say image.png and a file.pdf, I need to add the image as the first page of the pdf file, in order it has the same dimensions as the other pages, and in order to be recognized by any thumbnailer. If I do : size =…
lalebarde
  • 1,684
  • 1
  • 21
  • 36
3
votes
0 answers

PHP PDFTK and Media Temple

Has anyone ever been able to install PDFTK on Media Temple GS? 1.a. If so, how? If not, is there anyway to merge PDF and FDF so the user get's served the PDF version with the FDF data? The reason is, if the user downloads the FDF data, they need…
Justin
  • 2,502
  • 7
  • 42
  • 77
3
votes
0 answers

Pdftk burst splitting PDF file generates nearly same size of the parent file

I have a 361 page PDF file and try to split each page into directory. I used burst method of pdftk. However, original file size is 11mb but the generated file sizes are 10mb which makes nearly 4gb when bursting done. pdftk orjFile.pdf burst output…
Erdi Atalay
  • 153
  • 1
  • 1
  • 8
3
votes
0 answers

pdftk docker composer for other container

I'm using container ubuntu 18.04 and want use pdtk I found this https://github.com/mnuessler/docker-pdftk how i can use this pdtk in other container ? when i add docker-compose version: "3.1" services: pdftk: build: docker/pdf-tk …
Developer
  • 2,731
  • 2
  • 41
  • 71
3
votes
1 answer

PDFTK Cannot Create User Directory

I am attempting to run pdftk as user www-data with the following command (as root): sudo -u www-data /snap/bin/pdftk But I am getting this error: cannot create user data directory: /var/www/snap/pdftk/9: Read-only file system (Ubuntu 18.04,…
Ryan Griggs
  • 2,457
  • 2
  • 35
  • 58
3
votes
1 answer

Using the mikehaertl\php-pdftk library for manipulating PDFs, chaining commands fails when getDataFields is called first

I'm attempting to create a wrapper class around the mikehaertl\php-pdftk\pdf object for the purposes of populating PDF form fields. When trying to chain commands via the documentation the pdf fails to correctly execute the second command (or any…
c0pp3rt0p
  • 141
  • 1
  • 8
3
votes
0 answers

Is it possible to fill the forms of a pdf using pdftk without breaking Adobe Reader's interaction?

Consider this PDF form. I'd like to fill it using pdftk, as in this question, but preserve the ability to open and edit the form fields in Adobe Reader, as well as preserve the Javascript validation. Consider the following fdf file, which we can…
merlin2011
  • 71,677
  • 44
  • 195
  • 329
3
votes
2 answers

Parse colon-separated list into data.frame

This question is a follow-up of this. The following metadata.txt has been generated by: pdftk sample.pdf dump_data > metadata.txt metadata.txt: InfoBegin InfoKey: ModDate InfoValue: D:20170817080316Z00'00' InfoBegin InfoKey:…
Sati
  • 716
  • 6
  • 27
3
votes
1 answer

How to make streamed PDF merging without memory consumption?

I need to merge many small pdf files to one big pdf (~200G). And I can't find library/tool that can do it without eating all my memory. I watched to itext, pdfbox, pdftk. But seems that all of them store file in memory. According to pdf file…
alhimik45
  • 92
  • 1
  • 10
3
votes
1 answer

rails send_file and send_data sends out zero byte files

I'm trying to send a pdf back to the user but I'm having serious problem getting send_file and send_data to work. I created the pdf file as follows: tmp = Tempfile.new('filled') new_tmp_path = PDFPrint.fill_form_using_pdftk(template_path,…
Dominic
  • 341
  • 2
  • 5
  • 15