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

scripting pdftk stamp on windows

I want to create a script which uses pdftk to add a watermark stamp to pdf files. After the stamp is applied the output file doesn't need to be renamed My problem is I don't know what the file name will be called, and pdftk requires a different…
0
votes
1 answer

Where is pdftk file location folder?

I have installed pdftk on my PC that I use for local development using XAMP. I have installed pdftk to my local directory. From the code bellow where should the file test.pdf be placed? I am getting fields.txt created in my websites root directory,…
Hubvill
  • 504
  • 1
  • 7
  • 16
0
votes
2 answers

If user inputs directory that has subdirectories search all subdirectories in root

This is a follow up to a question that has already been answered. If a user inputs "c:\folder" and there happens to be several folders in that directory how do I make it search all subdirectories in the requested root directory. Sample Code below…
Nick
  • 49
  • 5
0
votes
1 answer

Have user input desired folder to count PDF's

I have a script that counts the number of pages in a PDF unfortunantly it's limited to whatever folder you place it in. I was wonder what I would need to add in order to give the user the ability to select what directory to go to, Is this even…
Nick
  • 49
  • 5
0
votes
1 answer

Transparency lost when converting PDF to PDF/X1a with Ghostscript

We need to convert PDFs created with ApacheFOP and merged with pdftk to PDF/X-1a. I already created a PDFX_def.ps with the following content: %! % This is a sample prefix file for creating a PDF/X-3 document. % Feel free to modify entries marked…
BeeJay
  • 29
  • 1
  • 4
0
votes
1 answer

Inconsistent display of checkboxes on PDF form filled with PDFtk

I am filling PDF forms in my rails app with the pdf-forms (https://github.com/jkraemer/pdf-forms) gem, based on PDFtk. Text fields work as I would expect, but my checkbox fields do not. The boxes display well in Chrome, but in Preview and Mail the…
0
votes
2 answers

How to find PDF page orientation with 'pdftk'?

I need to find PDF page orientations with pdftk. I need to rotate landscape pages to portrait. It will be good if I get to know to find page height and width so that I can rotate files. Can I find this by using pdftk? Or can I find this in the PDF…
nandeesh
  • 753
  • 7
  • 16
0
votes
2 answers

php exec() function not working and not throwing error

I am trying to get the exec() function to file off a commad for pdftk and it is neither working and I cannot figure out how to capture the error if one is being thrown. I tried: $output = array(); $return_var = -1; exec('pdftk RabiesVacCert.pdf…
Wally Kolcz
  • 1,604
  • 3
  • 24
  • 45
0
votes
0 answers

PDFTK to fill form

I found this code function createFDF($file,$info){ $data="%FDF-1.2\n%âãÏÓ\n1 0 obj\n<< \n/FDF << /Fields [ "; foreach($info as $field => $val){ if(is_array($val)){ $data.='<
user4530822
0
votes
1 answer

Executing pdftk.exe with arguments in process

Currently struggling to get this process working: const string pdfkPath = "pdftk.exe"; var paths = new List(); paths.Add(@"C:\test.pdf"); paths.Add(@"C:\testje.pdf"); var cmd = String.Join(" ",…
0
votes
0 answers

exec not works in pdftk but in commandline

I have some pdf file in folder C:\wamp\www\PhpProject1\uploads\1\AllFiles and pdftk exists in the same folder.In case of merging by commandline C:\wamp\www\PhpProject1\uploads\1\AllFiles\pdftk *.pdf output 123.pdf works. but in php i am using…
user3789344
  • 81
  • 1
  • 3
  • 14
0
votes
0 answers

PHP Execute bat file on windows server

I have a PHP file that creates a pdf fill form and uses pdftk to merge the data into the template. I am having trouble getting php to execute the batch file in order to run the program and merge it. $current =…
SBB
  • 8,560
  • 30
  • 108
  • 223
0
votes
1 answer

FPDF FPDM - Merge Error due to PDFTK

firstly :It's my first Question here then sry if the code synthax isn't easy to read, Don't find a way to make it clean. I'm trying to fill my big PDF template, which I made with Adobe Creator. FPDM works fine with the template.php which is include…
Paul Leclerc
  • 1,117
  • 1
  • 14
  • 18
0
votes
2 answers

Visit all subdirectories and extract first page from every pdf

I have a few folders with E-Books and I want to extract first page from every book. There are over two hundred books so doing this manually it's a big pain in the back and will be very time consuming. I have a command that does the job for single…
user127161
  • 41
  • 1
  • 1
  • 5
0
votes
1 answer

pdf file encryption function error

for testing the encryption function (by default 128 bit encryption) , i created a pdf file 'apps.pdf' with password protected 'abcd' as password. source code 1: use PDF::Tk; my $doc = PDF::Tk->new( pdftk => '/apps/free/pdftk/1.44/bin/pdftk'…
user142847
  • 15
  • 6