Questions tagged [pdftk]

The tag has no usage guidance.

0
votes
0answers
16 views

How do I append whitespace to single-page pdf?

Consider the following two pdf files. $ pdfinfo coreBasedAPI.pdf Creator: TeX Producer: pdfTeX-1.40.18 CreationDate: Thu Mar 21 15:56:46 2019 PDT ModDate: Thu Mar 21 15:56:46 ...
1
vote
1answer
89 views

how do I copy or create a new pdf file without password-protection?

Sometimes I get password-protected pdf files from people with passwords in the mail. It becomes a pain to remember them. The pdf file are usually version 1.4 documents, this information I am sharing ...
1
vote
1answer
56 views

Rearrange pdf pages (swap odd pages and even pages)

I have a pdf and I am in need to replace even and odd pages. If I want to be more specific, I must replace (2n-1) page numbers with (2n) ones (1-->2, 2-->1, 3-->4, 4-->3, and the like). How should I ...
2
votes
1answer
75 views

“Place” Letter Sized PDF to Larger pdf at specific position

Lulu is a print on-demand service. Part of the creation process is to upload a cover. The "cover" is 1 page that has the dimensions 17.25 inches wide by 11.25 inches high. There is a 0.125 "bleed area"...
1
vote
0answers
126 views

What tool can be used to change the orientation of a pdf page without using the `Rotate` key value?

On page 78 of the PDF Specification 2008, it mentions that the PDF's page object has an integer key value Rotate that you can set to tell the software how the page should be displayed. This value ...
1
vote
1answer
224 views

Merge content of PDF pages from command line without pdftk

I have two PDF files, each has the same number of pages. I want a PDF file with the same number of pages, and each page is a superimposition of the pages of the same number in the two source files. As ...
1
vote
0answers
34 views

PDFtk on RHEL 5.6

My colleagues and I are trying to install PDFtk on a RHEL 5.6 server. PDFtk requires libgcj which is installed, but an older version (v4.1.2) When we install PDFtk and try to add a password to a PDF ...
0
votes
0answers
490 views

Delete/add/replace pages in PDF while preserving bookmarks [duplicate]

Is there an easy CLI method to do that? If I use pdftk, I get a new pdf without the bookmarks of the original one. The bookmarks were created on another system with Adobe Acrobat Pro, and an example ...
1
vote
1answer
212 views

How to concatenate pdf files with different frame sizes

For concatenating presentations of the same topic I use pdftk (e. g. pdftk stones\ in\ england.pdf stones\ from\ namibia.pdf cat output nice\ stones.pdf). Files with diferent frame sizes but same ...
1
vote
2answers
280 views

Is there a convenient way to insert blank pdf pages into my pdf?

I have a pdf file foo.pdf. I want to create a pdf file foo-blankbacks.pdf whose odd pages are the pages of foo.pdf and whose even pages are blank. Can this be easily accomplished from the command line?...
2
votes
1answer
149 views

pdftk can't handle emdashes in filenames

I'm trying to use pdftk (v 1.40) to combine some pdfs (using it's cat command). As a simple test, I can do pdftk "/home/deploy/Foo - Bar.pdf" cat output results.pdf and that works fine (I'm only ...
0
votes
1answer
73 views

lp add file-path to pdf

Is there an easy way how to add a filepath (or a string) to a printed pdf using lp, convert, pdftk, python or friends? I want to print a bunch of pdf files with watermarks/headers which are parts of ...
0
votes
1answer
410 views

How to display bookmarks in the initial view when opening a PDF file?

I'm looking for a way to modify an existing pdf file so that the bookmarks panel opens automatically (on the right hand side) when I open the pdf file in acrobat reader or another reader. In https://...
0
votes
1answer
227 views

Avoid temp-file when adding a property to a PDF file in bash script

The following script makes use of a temporary file "data.txt" to which something is appended before reusing it. (Actually I simply add some metadata to a PDF) #!/bin/bash PDFTK="/app/bin/pdftk" #...
45
votes
8answers
33k views

Command line: How do you rotate a PDF file 90 degrees?

When I scan documents that are landscape oriented, the output PDF files are portrait and so all the PDF viewers display the scanned documents in portrait. From the command line, how do you rotate a ...
4
votes
3answers
817 views

How to pdftk end minus 1?

I want to exctact pages from a pdf document such that all pages are extracted except the first one and the last one. Code but (end-1) does not work, nor 2-end-1 pdftk 1.pdf cat 2-(end-1) output ...
0
votes
1answer
168 views

How to turn a text pdf into picture pdf?

How to transform a pdf with text into a "picture pdf", that is, a pdf based on pictures in one single command? I can obviously run multiple commands to do it but I am sure there is a straightest way ...
1
vote
1answer
346 views

Escape whitespace in find for pdftk without xargs -J

I'd like to concatenate all PDFs in subdirectories, with filenames potentially containing whitespaces. I am well aware of this solution, find . -name *.pdf -print0 | xargs -0 -J FILE pdftk FILE cat ...
1
vote
0answers
767 views

Manual install of pdftk can't find libgcj library

I'm trying to get pdftk running on my shared hosting account (no root access). I followed the instructions here, mainly: $ mkdir -p [my_project]/vendor/pdftk/lib [my_project]vendor/pdftk/bin $ cd /...
1
vote
0answers
24 views

How to merge pages of a pdf from the command line [duplicate]

From a pdf of n pages, how to reduce by half the number of pages by merging several pages on a single page? Each pair of pages from the old pdf should be found side by side on the new pdf.
3
votes
0answers
864 views

pdfimages wont extract all images

I'm using pdfimages to extract images from a PDF File. I've counted at last 10 images. But the program will only extract 4. pdfimages -all file.pdf i Generates -rw-rw-r-- 1 victor victor 61389 ...
3
votes
1answer
7k views

Proper way to convert PDF to word from bash command-line

I need to convert 1K pdf files to doc on a debian server. I can convert a PDF to word using libreoffice commandline: libreoffice --headless --invisible --convert-to doc Sample-doc-file-100kb.pdf Or ...
3
votes
2answers
802 views

Concatenate PDFs but extend pdf's to be even number of pages

I want to concatenate a bunch of PDFs but for printing purposes I would prefer that empty pages are added to each document that have an odd number of pages. Can I do this with PDFTK?
1
vote
0answers
217 views

How to remove zoom information from a PDF bookmark

I have a PDF file with bookmarks (aka index and document outline), which seem to specify the zoom in which the document is displayed after the link is followed. I know this because when I view the ...
1
vote
1answer
1k views

Write PDF metadata from the file name using Exiftool or PDFtk

I have thousands of PDF files named in the format Author Year Title of the book The first two spaces are relevant: they make a break between the Author, the year and the title. The title could ...
11
votes
2answers
6k views

Printing two pages per sheet from the command line

Say I start off from a PDF document, say of 12 pages, viewed with evince. To produce another PDF of 6 sheets, with a page setup of two pages per side, I normally use the "Print to File" device ...
4
votes
3answers
4k views

cygwin and pdftk

I have spent a long time looking around and Goggling for this but I am no closer to getting this install. I have Cygwin install 64-bit version. And have installed apt-cyg and using this I have ...
1
vote
1answer
2k views

Overlay text in PDF via command line

The following command produced the result of the following image using convert, where an overlay box containing the letter "A" was layered over the PDF: convert online_gauss.pdf -fill white -...
3
votes
1answer
182 views

Extract completed slides of a slide show PDF

PDF files of slide show presentations distributed by my lecturers often contain a huge number of pages, because each animation step results in an new page (sometimes 20 pages per slide). This is nice ...
1
vote
0answers
423 views

How do I encrypt (password protect) a PDF without encrypting the metadata?

It seems that the encryption provided by pdftk(1) is the level supported by Acrobat 5 (I added a password to a PDF file using pdftk then opened it in Acrobat Pro 9 and examined the security settings; "...
3
votes
1answer
1k views

How can I rasterize all of the text in a PDF?

You know when you have a pdf, which is a scan of a document and it's a really huge file, because it just stores the picture of the scanned document? And there are OCR tools which can help you to ...
2
votes
1answer
930 views

Recover pdf from extracted images

Here is the information of images in a single-page pdf file: $ pdfimages -list p1.pdf page num type width height color comp bpc enc interp object ID -------------------------------------------...
2
votes
1answer
753 views

All PDF applications mix the width and height of a PDF file

I have this PDF file created by scanning. When viewing it in any PDF viewer, the page's width is greater than the height. But it seems like all the PDF applications I have tried mistake the width as ...
4
votes
1answer
169 views

Avoid bloating file size when removing OCRed text from a pdf file?

I use pdfimages and convert recommended by Anthon to remove the OCRed text of a pdf file, and the size of the pdf file changes from 29MB to 373MB. My first step is split the pdf file into a pbm file ...
1
vote
2answers
423 views

pdftk: cannot view pdf file

I am trying to view/edit a pdf file in pdftk, and I get the following error: [lucas@lucas-ThinkPad-W520]~/Downloads$ pdftk file.pdf Done. Input errors, so no output created. What am I doing wrong? ...
4
votes
1answer
2k views

Easiest method to create pdf from template using command line (without pdflatex)?

For ten years I have been generating billings for me and my wife in this way: Create TeX template with LyX or by hand Using in this source placeholder text Then: cat template | sed s/placeholder1/...
3
votes
1answer
783 views

Corrupted PDF: Opens fine, but pyPdf bails with AssertionError

I received a PDF in an email and I want to crop and rotate it because it has two pages per sheet. Trying the solutions in Split pages in pdf I had problems with "AssertionError" in pyPDF and "Warning: ...
2
votes
2answers
2k views

Splitting large PDF into small files

Using pdftk it is possible to extract page ranges from a pdf using pdftk a.pdf cat 124-end output b.pdf dont_ask I have a bunch of huge PDFs with about 500 pages and over 100 MB, is it possible to ...
2
votes
0answers
166 views

Insert bookmark in .pdf file for print

I have searched many solutions on what is the best way to search a .pdf, and if a page named spec_out is located in the .pdf it will insert the first bookmark before other bookmarks as Spec Out. I'm ...
1
vote
0answers
61 views

How do I unbooklet a PDF-booklet? [duplicate]

Possible Duplicate: How do I 'unbook' a pdf I'm not shure that what I have is actually a booklet, or a book. I have a paper in A4-format consisting of 96 pages (plus coverpages). I opened ...
1
vote
0answers
37 views

Rescale a PDF file [duplicate]

Possible Duplicate: How to change height and width of each page of a pdf Is it possible to rescale a PDF file (retaining perspective) to be within a maximum width / height? Rendering to an image ...
4
votes
1answer
2k views

Implementing a String -> PDF Stamp tool

I wrote a little shell function which creates a fixed-size PDF file (A4) from a character string using gs: make_stamp() { file=$1 string=$2 tmp=${file}-small.pdf gs -o "$tmp" -sDEVICE=pdfwrite -...
10
votes
1answer
832 views

How do I 'unbook' a pdf

I have a pdf file that was made into a booklet format. It is meant to print on A4 paper in landscape orientation; here are two pages in the pdf, which should correspond to four pages in the actual ...
24
votes
3answers
16k views

Rotate pdf pages: 90 degree for even pages and -90 degree for odd pages

I was wondering in a pdf file, how to rotate pdf pages: 90 degree for even pages and -90 degree for odd pages? By pdftk, all I know is to rotate a page by pdftk in.pdf cat 1W output out.pdf, and ...
22
votes
9answers
24k views

Add and edit bookmarks to pdf

By getting metadata from some pdf files with bookmarks by pdftk, I observe the format of bookmarks in pdf metadata. So I am guessing that with pdftk, it is possible to add and edit bookmarks of a pdf ...
12
votes
4answers
5k views

How to preserve bookmarks when rearranging pages of a PDF file with tools like pdftk?

I am using pdftk to rearrange pages of a pdf file with bookmarks/outlines, but after that, the output file lost the bookmarks of the original. My command is pdftk in.pdf cat 1-22 43 23-42 44-end ...
13
votes
1answer
15k views

How do I insert a blank page into a PDF with ghostscript or pdftk?

I have a PDF file that needs a blank page inserted into it every so often. The pattern is unpredictable, so I need a command that will allow me to fit one in wherever necessary. How can i do this?