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"
705
questions
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?
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? ...
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 ...
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 ...
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-...
88
votes
2
answers
75k
views
Discovering metadata about a PDF
Suppose I have a PDF and I want to obtain whatever metadata is available for that PDF. What utility should I use?
I find the piece of information I am usually most interested in knowing is the paper ...
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 ...
83
votes
11
answers
217k
views
View pdf file in terminal
I want to view pdf files directly on our cluster rather than copying them to my local machine and then opening them in a viewer.
How can I view a pdf file in my terminal?
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" -- ...
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 -...
74
votes
11
answers
64k
views
Pdf reader that supports XFA forms (while Adobe Reader for Linux is not supported anymore)?
XFA forms are features of a pdf file involving options to complete fields in certain documents - in many cases official documents. These options may open a calendar, for example, in order to select ...
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 ...
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 ...
61
votes
5
answers
50k
views
How do I reduce the size of a pdf file that contains images?
I have a pdf file that contains images and I want to reduce its size in order to upload it to a site with a size limit.
So, how can I reduce the size of a pdf file from the command-line?
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 ...
49
votes
6
answers
103k
views
Is there a command-line tool for converting html files to pdf? [duplicate]
I would like to install a command line tool within a Docker image in order to quickly convert *html files into *pdf files.
I am surprised there is not a Unix tool to do something like this.
49
votes
5
answers
43k
views
How to query pdf page size from the command line?
For scripting I need to get the page dimensions of a PDF file (in mm).
pdfinfo just prints it in 'pts', e.g.:
Page size: 624 x 312 pts
What should I use?
Or what unit is 'pts' anyway - in ...
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.
43
votes
3
answers
26k
views
How to enable copy-to-clipboard with zathura-pdf-poppler?
How do I make Zathura copy selected text to the system clipboard?
I'm using Zathura with the poppler PDF plugin.
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 ...
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:
...
34
votes
9
answers
37k
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 ...
28
votes
3
answers
27k
views
Use convert to grab a specific page from a PDF file?
I know I have done this before, so I'm sure it's possible, I just forget how to do it. There's a way to tell convert to grab a specific page of a PDF, and I'd like to keep the format of that page as ...
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 ...
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?
28
votes
4
answers
26k
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?
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 ...
24
votes
6
answers
42k
views
Modifying PDF files
I would like to do some basic editing on existing PDF file. More specifically:
Add chapters/bookmarks
Change page numbering
However, I cannot find any tool, GUI or command line, which would offer ...
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 ...
24
votes
1
answer
12k
views
Can Zathura's "dual" page mode use a page offset?
When viewing PDFs that are setup for print, I often want to view facing page spreads. Typically PDFs are typeset such that the first page of the file/part/chapter always starts on a right page so ...
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 ...
21
votes
8
answers
15k
views
How to merge 2 PDF files with interleaving pages order?
I've got a double-side-printed multipage document to scan with a linear bulk scanner. So, as the result I get 2 PDF files: one containing all odd pages and the second containing all even pages. I need ...
20
votes
5
answers
18k
views
Storing Okular PDF annotations and metadata in the PDF itself
The PDF viewer Okular (part of KDE desktop) has lots of nice features and supports lots of file formats.
One of the things I like about it is the comments and annotations.
Unfortunately, all of the ...
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 ...
19
votes
2
answers
11k
views
Export a man page in pdf
Doing man -t man > man.ps will export the man page for man in postscript.
How can I export it in PDF?
I have gone through the manuals and learnt about the -T option but it's a bit unclear to me.
19
votes
3
answers
15k
views
Markdown to PDF conversion in Pandoc: making pages landscape?
I am converting a document from Pandoc markdown to .pdf.
I run the conversion like this, and everything works fine:
pandoc test.MD -f markdown -o test.pdf
However, I would like pandoc to output my ...
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 ...
19
votes
2
answers
7k
views
Merge pdf files and automatically create a table of contents with each file as an entry
I have several pdf files (chapter1.pdf, chapter2.pdf, etc.), each one being a chapter of a book. I now how to merge them into a single pdf (I use the command pdfunite from poppler), but since the ...
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?
18
votes
3
answers
13k
views
How to extract annotations from PDF files?
Is there a command-line tool to extract annotations (comments added using evince) from PDF-files?
I search such a solution to send people feedback on their submitted documents. Apart from replying ...
18
votes
3
answers
3k
views
Replace an image in a PDF using command line
I need to process some PDF files. The task consists in exchange a given image file by another. My first problem is how to replace a PDF image from command line in a batch process. Next I'll try to ...
17
votes
6
answers
18k
views
How do I delete a page from a PDF in Okular?
Didn't see an option in the menus or any documentation on what I imagine is something simple:
I have a multi-page PDF and want to delete a specific page within Okular's GUI.
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 ...
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 ...
17
votes
3
answers
23k
views
Removing metadata from a PDF
What commands must I issue irreversibly to remove all metadata
from foo.pdf? Assume embedded images are already clean.
I got the impression from
https://gist.github.com/hubgit/6078384
that
exiftool -...
17
votes
5
answers
14k
views
Open signed PDFs in Linux
We have some PDF files which are secured by a .pfx certificate.
On Windows we can use Adobe Reader to read these PDF files (with previously imported certificate).
I've googled for a long time but I ...
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 ...
16
votes
4
answers
20k
views
Preview PDF as image in ranger
How can I preview PDFs as images in ranger? By default it uses pdftotext (in the scope.sh preview configuration file), but I would like to use pdfimages, pdftoppm, or another graphical solution ...
16
votes
2
answers
5k
views
How can I calibrate Zathura's zoom levels to my monitors?
I'm using Zathura (using the MuPDF plugin) to review various layouts for printing. It's important to me that I'm looking at things approximately the same size as they will come out on paper. I realize ...
15
votes
1
answer
3k
views
How does Linux allow modifying a PDF while open in a PDF viewer?
When I am working with graphs in R, I try to output them directly into PDF. For e.g. the code for creating a graph is as follows.
library(ggplot2)
levels_fp = ggplot(data=df_forest_2,
aes(x = ...