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

How to repair a PDF file and embed missing fonts

I use pdftk to repair some failures in corrupted PDF files, but I faced another problem which is not fixed by pdftk (or at least I do not know how to do so). I have PDF files with text based on TrueType fonts, but the fonts have not been embedded…
Googlebot
  • 15,159
  • 44
  • 133
  • 229
16
votes
8 answers

How do you combine PDFs in ruby?

This was asked in 2008. Hopefully there's a better answer now. How can you combine PDFs in ruby? I'm using the pdf-stamper gem to fill out a form in a PDF. I'd like to take n PDFs, fill out a form in each of them, and save the result as an n-page…
Paul Schreiber
  • 12,531
  • 4
  • 41
  • 63
15
votes
3 answers

PDF Form filling with FPDF and then Flatten with PDFTK displays un-filled PDF

I'm using the "Form Filling" script from fpdf.org to fill some fields on a PDF Form I created. This appears to work properly. I want the resulting PDF form to be flattened so users can not edit the form fields. I'm using PDFTK for that. However,…
user1855093
  • 373
  • 1
  • 2
  • 14
15
votes
8 answers

Insert a blank page between each existing page in a PDF document

I've got a PDF and I want a fast way to insert a blank page every second page (except at the end). E.g. my PDF has the pages 1: A 2: B 3: C 4: D it should look like: 1: A 2: empty 3: B 4: empty 5: C 6: empty 7: D Is there any easy scripting way to…
tim
  • 9,896
  • 20
  • 81
  • 137
14
votes
1 answer

Open a pdf with blank password with pdftk

We occasionally receive pdf files with blank/empty passwords. We use pdftk and under these circumstances it fails. We have tried: pdftk input.pdf input_pw output output.pdf pdftk input.pdf input_pw \ output output.pdf pdftk input.pdf input_pw ''…
Bill Butler
  • 479
  • 3
  • 16
14
votes
3 answers

Add margin to PDF file when merging using PDFTK or similar

I have a large collection of half-page sized PDF cut-sheets that are held in a folder on my Linux server. A user to the site will want to create a booklet from a subset of these. The booklet will be bound therefore the even pages of the collection…
Bob Brunius
  • 1,344
  • 5
  • 14
  • 21
13
votes
1 answer

Stamp PDF file with control for position of stamp file

Does anyone know about stamping PDF file to PDF file and also controls for positioning PDF file stamp? I have a file orginal.pdf and logo.pdf. I want to stamp logo.pdf file to file orginal.pdf at the top left of file original.pdf. How can it be done…
een qren
  • 139
  • 1
  • 1
  • 4
13
votes
3 answers

Problem with size of the imported PDF template with FPDI+TCPDF

I am stuck in a very complex situation. I am working on a PHP Web apps for Greeting card. For this, I am using some Linux tools and TCPDF and FPDI. Let me tell you how it all works: there is 4 page greeting card template PDF file. this is custom…
Ravish
  • 2,383
  • 4
  • 37
  • 55
13
votes
1 answer

set output location for pdftk sample.pdf burst

I've a question, I am using tdftk to split pages of a pdf file from php. using following command $command = escapeshellcmd("pdftk ").escapeshellarg("/var/www/card/card.pdf")." ".escapeshellcmd(" burst"); $result = passthru($command); it's working…
Ravish
  • 2,383
  • 4
  • 37
  • 55
13
votes
3 answers

Fill PDF form using Ruby

I'm trying to programmatically fill out a pdf using ruby. The pdf has fields that permit text to be entered: I've had success in the past using pdftk via the pdf_form gem, however it doesn't find the fields in this particular pdf: $ pry [1]…
dug
  • 2,275
  • 1
  • 18
  • 25
12
votes
13 answers

Flatten FDF / XFDF forms to PDF in PHP with utf-8 characters

My scenario: A PDF template with formfields: template.pdf An XFDF file that contains the data to be filled in: fieldData.xfdf Now I need to have these to files combined & flattened. pdftk does the job easily within php: exec("pdftk template.pdf…
Mateng
  • 3,742
  • 5
  • 37
  • 64
11
votes
6 answers

Split PDF by multiple pages using PDFTK?

I am finding it hard to phrase this question and could not find an online solution for what I'm trying to do. I know how to split a large PDF into single pages with PDFTK using the following script: pdftk your_file.pdf burst output…
m0chi
  • 158
  • 1
  • 3
  • 13
10
votes
1 answer

Modify existing PDF to add "Page N of NNN" footer

How can I use pdftk either from the command line (or preferably from Ruby) to add page numbers to the bottom of a pre-existing PDF? I'm looking for this format: Page 1 of 2 Page 2 of 2
jrhicks
  • 14,759
  • 9
  • 42
  • 57
10
votes
2 answers

pdftk Error: Failed to open PDF file:

I am using pdftk library to extract the form fields from the pdf .Everything is just running fine except the one issue that i got a pdf file pdf file link. which causes the error is given bellow Error: Failed to open PDF file: …
Manoj Dhiman
  • 5,096
  • 6
  • 29
  • 68
10
votes
1 answer

Attach an image to an existing PDF at the right position

So, here's the thing, we have a bunch of pdf forms for users on our website to fill out, we have a submission button inside every pdf form that sends the filled data through a http post method. We are already doing a pre-filled form, where the user…
Caio Luts
  • 367
  • 2
  • 14
1
2
3
33 34