Questions tagged [pdf]

PDF (Portable Document Format) is an open standard for fixed format document exchange. Use this tag to indicate questions involving files in this format and also when software is generating/processing this format. When possible and possible relevant indicate the version of the PDF document (as retrieved from the file properties, or using "file document_name.pdf"

Filter by
Sorted by
Tagged with
277 votes
19 answers
189k views

How can I grep in PDF files?

Is there a way to search PDF files using grep, without converting to text first in Ubuntu?
Dervin Thunk's user avatar
  • 3,549
84 votes
12 answers
54k views

Split pages in pdf

I have a scanned PDF file in which two different real pages appear together on one virtual page. The resolution is with good quality. The problem is I have to zoom when reading and drag from left to ...
xralf's user avatar
  • 15.4k
0 votes
1 answer
199 views

Modifying the search result of grep

Normally, we can search a keyword in a list of pdf files using the following command: for file in *pdf; do pdftotext "$file" - | grep keyword done Now, from the search result, If I want to find the ...
user avatar
77 votes
12 answers
174k views

How to convert TXT to PDF?

I want to convert .txt files to .pdf. I'm using this: ls | while read ONELINE; do convert -density 400 "$ONELINE" "$(echo "$ONELINE" | sed 's/.txt/.pdf/g')"; done But this produces one "error" -- ...
LanceBaynes's user avatar
  • 40.2k
46 votes
6 answers
32k views

Is there some sort of PDF-to-text converter?

I need PDF files in text so I can search over them in bulk from commandline. Is there some converter for Ubuntu, OBSD or similar distro? Perhaps related post, OCR with Ubuntu here.
otto's user avatar
  • 561
1 vote
1 answer
345 views

How can you pdfjoin smartly different sized pictures?

I'm running the default pdfjoin and getting results like this: How can you pdfjoin different sized pictures? My first idea is to add an empty page in front of all things.
Léo Léopold Hertz 준영's user avatar
34 votes
9 answers
38k views

Add and edit bookmarks to a PDF file

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 ...
Tim's user avatar
  • 102k
21 votes
4 answers
50k views

How to view and edit the code of a PDF file

I was wondering how to view and edit the code of a PDF file? By viewing, I don't want to see the binary format, so I think hexdump may not be what I want. I tried gedit, but no encoding method can be ...
Tim's user avatar
  • 102k
17 votes
4 answers
14k 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 ...
XavierStuvw's user avatar
  • 1,119
3 votes
2 answers
1k views

How can I get the page numbers only of a pattern in a pdf file, regardless if the pattern is multiline?

I find the page numbers of a multiline pattern in a pdf file, by How shall I grep a multi-line pattern in a pdf file and in a text file? and How can I search a string in a pdf file, and find the ...
Tim's user avatar
  • 102k
102 votes
11 answers
59k views

How do I create a blank PDF from the command line?

I recently needed a single blank PDF page (8.5" x 11" size) and realized that I didn't know how to make one from the command line. Issuing touch blank.pdf produces an empty PDF file. Is there a ...
Brian Fitzpatrick's user avatar
91 votes
4 answers
69k views

How to OCR a PDF file and get the text stored within the PDF?

First, apologies if this has been asked before - I searched for a while through the existing posts, but could not find support. I am interested in a solution for Fedora to OCR a multipage non-...
ingli's user avatar
  • 1,859
74 votes
1 answer
60k views

Convert pdf to a different page size (US Letter -> A4)

I'm trying to print a simple US Letter document, but for some reason, I just cannot manage to fit it properly onto A4 when printing multiple pages per-list. I have tried converting the pdf using: gs -...
Šimon Tóth's user avatar
  • 8,248
67 votes
6 answers
129k views

pdf to jpg without quality loss; gscan2pdf

When I convert a pdf file to bunch of jpg files using convert -quality 100 file.pdf page_%04d.jpg I have appreciable quality loss. However if I do the following, there is no (noticeable) quality ...
student's user avatar
  • 18.3k
63 votes
9 answers
94k views

convert images to pdf: How to make PDF Pages same size

I did something like convert -page A4 -compress A4 *.png CH00.pdf But the 1st page is much larger than the subsequent pages. This happens even though the image dimensions are similar. These images ...
Jiew Meng's user avatar
  • 2,443
57 votes
6 answers
69k views

How to set password for pdf files?

I need to password protect my PDF file(s), because I am going to send them through email and I want anyone who would view my PDF file(s) to be prompted for a password. How can I add a password to a ...
David's user avatar
  • 731
39 votes
6 answers
34k views

Is there a way to flatten a .pdf image from the command line?

In GIMP, I can import a PDF, and use the GUI to flatten it (if it was made with many layers) by selecting Flatten Image in the Image dropdown menu. I can then export the PDF with a new filename. I ...
generic_user's user avatar
28 votes
4 answers
31k views

How to know if a PDF file is compressed or not and to (un)compress it

I just learned that PDF files can be compressed to reduce their disk size. I was wondering how to know if a PDF file has already been compressed? What applications/commands can be used to compress ...
Tim's user avatar
  • 102k
24 votes
5 answers
34k views

Text annotations and image additions to PDF file using free software

I'm mostly interested in annotating a PDF file with text at a predetermined position. GUIs and command line utilities are both Ok, but only free software solutions, please. However, I included image ...
Faheem Mitha's user avatar
  • 35.2k
19 votes
5 answers
8k 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 ...
Tim's user avatar
  • 102k
19 votes
9 answers
10k views

How can I split each PDF page into two pages, using the command line?

I have a few ebooks scanned from originals. They're formatted so that a single PDF page contains two actual pages: one on the left, and one on the right. I want to programmatically split each PDF ...
Philip Kirkbride's user avatar
18 votes
4 answers
20k views

Is there a pdf viewer capable of opening multiple documents in the same window?

I would like to open all chapters of my PDF ebooks in the same window but neither evince nor okular seems to be capable of doing that (at least not out-of-the-box). Is there a way to work this out?
posdef's user avatar
  • 579
14 votes
5 answers
7k views

Extract even-numbered and odd-numbered pages of a PDF into two separate PDFs

I have a PDF that consists of several hundred pages of bilingual text. Since I need to use OCR on each language separately, I want to grab the even and odd pages and make two separate PDFs, using ...
ixtmixilix's user avatar
  • 13.2k
12 votes
4 answers
67k views

How to install Adobe Acrobat Reader in Debian?

I've got deb http://debian-multimedia.org squeeze main in "/etc/apt/sources.list", but wajig update && wajig install acroread results in: E: Package ‘acroread’ has no installation candidate ...
tshepang's user avatar
  • 65.8k
9 votes
1 answer
1k views

How may I recover a lost pdf file?

I accidentally lost a pdf file during the following process I was running a pdf software application PDFXCView in Wine in Ubuntu 18.04, to open a pdf file in a ext4 filesystem. Then I mv the pdf ...
Tim's user avatar
  • 102k
8 votes
7 answers
9k views

convert a html book to a pdf file?

How can I convert a html book (consisting of a number of html files linked to each other) to a pdf file on Ubuntu? Hope the resulting pdf file can have bookmarks according to the structures of the ...
Tim's user avatar
  • 102k
7 votes
2 answers
8k 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 -...
Bruno Silva's user avatar
4 votes
1 answer
2k views

How to change height and width of each page of a pdf

I was wondering how to change width and height of each page of a pdf? In my scanned pdf, each page has paper size too big, 31.98 × 49.20 inch. I would like to shrink the width and height to smaller ...
Tim's user avatar
  • 102k
4 votes
1 answer
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 -...
fommil's user avatar
  • 643
4 votes
3 answers
16k views

How to Install adobe reader-enu in 64-bit Debian 8.5?

Situation: to have Advanced search (like Adobe Acrobat's one) in any pdf reader; search many documents and have integrated view for their review I know the thread about installing Adobe reader by ...
Léo Léopold Hertz 준영's user avatar
4 votes
2 answers
2k views

Exchange odd and even pages in a pdf file?

Is it possible to exchange odd and even pages in a pdf file, e.g. page 1 and page 2 exchange, page 3 and page 4 exchange, ..., assuming the pdf file has even number of pages? Can it be done using ...
Tim's user avatar
  • 102k
3 votes
1 answer
2k views

Possible to extract title and pagenum of each page in a pdf file

I was wondering if there are some ways to extract title and pagenum of each page in a pdf file? Either by some applications, or by programming in some programming language with some pdf libraries? ...
Tim's user avatar
  • 102k
265 votes
20 answers
215k views

How can I add a signature .png to a PDF in Linux?

I have a scanned copy of my written signature and I need to apply it to some documents in the signature block. I used to do this on Windows all the time but I now have only Linux. Is this possible? ...
Freedom_Ben's user avatar
  • 4,494
187 votes
10 answers
156k 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 ...
Trevor Boyd Smith's user avatar
37 votes
4 answers
23k views

Rotate PDF pages: 90 degrees for even pages and -90 degrees for odd pages

In a PDF file, how to rotate pages 90 degrees for even pages and -90 degrees for odd pages? With PDFtk, all I know is to rotate a single page: pdftk in.pdf cat 1W output out.pdf And rotate all pages: ...
Tim's user avatar
  • 102k
28 votes
4 answers
9k views

How to reverse the page order of a PDF file?

Is there an easy (preferably command line) way to reverse the pages in a PDF file?
user905686's user avatar
25 votes
7 answers
51k views

How to convert a color pdf to black-white?

I'd like to transform a pdf with some coloured text and images in another pdf with only black&white, in order to reduce its dimensions. Moreover, I would like to keep the text as text, without ...
BowPark's user avatar
  • 4,905
17 votes
4 answers
31k views

Converting PDF to PDF/A?

Given a PDF of random origin, how do I, on Linux: confirm whether it is in PDF/A format already? if it is not in PDF/A format, convert it to PDF/A with a minimum loss of fidelity? I am aware that ...
user's user avatar
  • 28.9k
16 votes
4 answers
28k views

pdf viewer for command line only

Is it possible to view pdf documents without having gdm (or similar) running? Rationale: I'm working on a remote server (assume no X forwarding) processing some data, creating some plots (assume pdf ...
moooeeeep's user avatar
  • 1,313
14 votes
5 answers
4k views

List named destinations in a PDF

How can I list the named destinations in a PDF file? Named destinations are the formal name for what you might call anchors. Major browsers jump to the named destination foo when you follow a link to ...
Gilles 'SO- stop being evil''s user avatar
13 votes
5 answers
5k views

How can I merge pdf files so that each file begins on an odd page number?

I need to merge a few dozed pdfs, and i want all of the input pdfs to start on an odd page in the output pdf. Example: A.pdf has 3 pages, B.pdf has 4 pages. I don't want my output to have 7 pages. ...
Jan Warchoł's user avatar
  • 3,111
13 votes
5 answers
16k views

How can I convert a pdf file from gray-scale to black-white?

My OS is Ubuntu 12.04. How can I convert a pdf file from gray-scale to black-white? The gray-scale pdf file comes from scanning with gray-scale option, and the black-white scale pdf is required by OCR....
Tim's user avatar
  • 102k
12 votes
4 answers
13k views

How to convert libreoffice ODT to PDF in bash

I am using libreoffice under CentOS 6. I can convert ODT files to PDF with: libreoffice --headless --convert-to pdf *.odt but the problem is that it only works when no document is open in libreoffice....
Johan's user avatar
  • 123
10 votes
6 answers
3k views

Are there any full featured pdf readers that integrate comment function?

I'm needing reading some research papers whose formats are almost pdf.However I cannot find a good pdf reader which can make some notes while reading. Currently I use xournal however there seems not ...
Hongxu Chen's user avatar
  • 5,858
10 votes
5 answers
6k views

How can I convert a scanned PDF with OCRed text to one without OCRed text?

I have a scanned PDF file, with low-quality OCRed text. I would like to have a PDF file without the OCRed text. How can I convert a scanned PDF with OCRed text to without OCRed text? I am thinking ...
Tim's user avatar
  • 102k
9 votes
4 answers
9k views

How to mount a .jpg centered into a .pdf (using defined page size and borders)?

I'm looking to convert a .jpg into a .pdf, so that the .jpg is positioned at a certain location: centered on (say) an A4 page, with a minimum border of 30 pixels all around between image and page ...
chris mccoy's user avatar
8 votes
2 answers
2k views

Ways to convert and combine image files into a pdf file?

I have about 190 image files (png and jpg) in a directory. For more information, each image has 2500 x 3072 pixels, and about 500KB. I use the command convert from ImageMagik to convert and combine ...
Tim's user avatar
  • 102k
8 votes
3 answers
2k views

Is GNU PDF Library in active development?

I've been hearing about The GNU PDF Library since 2007. Since then I've been looking forward to see this tool in the wild, but four years have passed and it seems to me that this is a painfully long ...
Sergio's user avatar
  • 367
7 votes
4 answers
10k views

Split PDF into documents with several pages each

There are several resources on the web explaining how one can split a PDF into many files with on page per file. But how can you split them into chunks of, say, five pages each? I have looked into ...
Raphael's user avatar
  • 2,075
7 votes
3 answers
11k views

Where is metadata for PDF files? Can I insert metadata into any PDF file?

I have many files of music; with the program mp3Tag, I had organized all of it. I have the correct metadata as it allows. I am looking for a free software that does the same, but for PDF files.
Jaaziel Aguirre's user avatar