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
6
votes
3 answers

How to stamp only the last page of a PDF

I have the following code to stamp a pdf with a an image that is converted to a pdf. Everything seems to work except for it stamps every page in the pdf. How can i get it to only stamp the last page of the pdf? pdftk temp-pdfjam.pdf stamp…
Brad Hazelnut
  • 1,603
  • 5
  • 21
  • 33
6
votes
4 answers

Keep a pdf form editable after filling it with pdftk

I'm using pdftk to fill a form but the output form isn't editable, when I open it on acrobat reader I'm getting an error message: "This document enabled extended features in Adobe Reader, The document has been changes since it was created and use…
Adriano Bacha
  • 1,114
  • 2
  • 13
  • 22
5
votes
2 answers

Merge two PDF files -- one as background, one as foreground

I have two PDF-files. Both have the same geometry and the same amount of pages. I would like to merge them, such that one file is the background and one file is the foreground. I tried pdftk with the background option: pdftk bg.pdf background fg.pdf…
Dennis
  • 4,011
  • 7
  • 36
  • 50
5
votes
1 answer

Adjust PDF canvas maximum page size

I have a PDF document in which all page sizes are different. I want to adjust each page size (aka the canvas) to the maximum width and the maximum height found in the document, and then center it. I have got used to pdftk and Ghostscript, but I may…
Creasixtine
  • 740
  • 3
  • 11
  • 33
5
votes
4 answers

Missing characters in filled pdf using PDFTk with encoding UTF-8

I'm trying to fill pdf documents using PDFTk. Script working fine, it fills inputs in form but I don't get special characters [polish charset: UTF-8 or ISO-8859-2]. Script: https://github.com/mikehaertl/php-pdftk The weird thing is that generated…
Michał Lipa
  • 968
  • 2
  • 12
  • 22
5
votes
2 answers

How do I completely remove (all versions of) pdftk server from Mac OS X?

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 suspect…
malu
  • 53
  • 1
  • 5
5
votes
1 answer

PDFTK and removing the XFA format

Are there any issues that can come up of removing the XFA format from a PDF form? I'm using PDFTK to fill form, and found that if forms are XFA, then PDFTK doesn't work unless I do a drop_xfa command first to create a new template form. One thing I…
Unknown
  • 85
  • 1
  • 5
5
votes
3 answers

Read contents of the pdf using vim

How can we read contents of the pdf file using vim command in the terminal? I have tried using pdftk by uncompressing it but still its not working for me. Is there any other way to decrypt or decode the pdf so that we can read by the terminal in any…
Rohit Singhal
  • 429
  • 1
  • 3
  • 17
5
votes
2 answers

Concatenate PDFs without ruining accessibility or PDF tags

Would appreciate your help with the following: I have 2 partially accessible PDFs (containing tags), and I want to concatenate them using some command line tool (as PDFtk or Ghostscript, or any Perl module): I've tried doing this with PDFtk and…
user2522941
  • 119
  • 7
5
votes
1 answer

convert a directory of images into a single PDF

I have a directory of images: path/to/directory/ image01.jpg image02.jpg ... and would like to convert it into a single PDF file: path/to/directory.pdf This is what I managed to code so far: #!/bin/bash echo Directory $1 out=$(echo $1 |…
nobody2100
  • 161
  • 1
  • 7
5
votes
2 answers

Installing PDFTK on a shared web server

My web sites are hosted on Total Choice Hosting using some kind of Linux (I don't know what precise variety) and Apache. I don't have command line access - I can run command line programs only via exec() in PHP, or via CRON jobs. Can I install and…
rowan.bradley
  • 147
  • 3
  • 9
4
votes
2 answers

PDFTK with php://memory

Question: Is it possible to use php://memory on a exec or passthru command? I can use php variables in the exec or passthru with no problem, but I am having trouble with php://memory background: I am trying to eliminate all of my temporary pdf…
Cymbals
  • 1,164
  • 1
  • 13
  • 26
4
votes
2 answers

Weird characters when filling PDF with PDFTk

I'm using php with PDFTK on Ubuntu. When filling a PDF with data, I get weird characters for this letters with accents: á ó í. I'm using UTF-8 encoding: I checked with echo mb_check_encoding($var, 'UTF-8') which outputs 1 - TRUE. Any idea what I can…
sergio
  • 297
  • 3
  • 17
4
votes
2 answers

how to reduce the quality of pdf created using R

I am creating pdf reports using R (command ?pdf). The reports contain images that I have created and that are quite heavy (lot of datapoints) The created pdfs are very heavy. Is there a way to reduce the quality of the pdf when creating it? I know I…
RockScience
  • 17,932
  • 26
  • 89
  • 125
4
votes
3 answers

Find PDF Form Field position

I realize this question has been asked a lot, but I could not find any information about how to do this in RoR. I am filling a PDF with form text fields using pdf-forms but this does not support adding images, and I need to be able to add an image…
Libby
  • 932
  • 8
  • 15