Hot answers tagged

71

Just use pdftk. For rotating clockwise: pdftk input.pdf cat 1-endeast output output.pdf For rotating anti-clockwise: pdftk input.pdf cat 1-endwest output output.pdf Regarding the installation of pdftk on Fedora, I found this link.


57

I just stumbled upon this thread and saw that there is no good solution mentioned yet. I found that (at least on Debian and Ubuntu) pdfjam comes with the following commands: pdf90 input.pdf pdf180 input.pdf pdf270 input.pdf I think that is the easiest and fastest approach. These are scripts using the pdfjam command properly. Btw. the pdfjam is a virtual ...


25

In Linux Mint 18.3 (I believe in other Debian derived distributions as well) you have a simple command line tool named qpdf. You can use: qpdf in.pdf out.pdf --rotate=[+|-]angle[:page-range]. From the documentation: --rotate=[+|-]angle[:page-range] Apply rotation to specified pages. The page-range portion of the option value has the same format as page ...


19

You can use ImageMagick: display or convert - e.g. to rotate it clockwise use convert -rotate 90 <file>.pdf <rotated-file>.pdf Use -90 for a counterclockwise rotation. N.B. Only use this method when the original image is a bitmap (e.g. produced by scanning). If the original image is not a bitmap, this method will convert it to one and quality ...


13

pdftk is no longer available on Ubuntu 18.04 due to some deprecated dependencies. The best solution I found was the (graphical) tool pdfshuffler. Install and run it. Open the desired pdf file, right click on the page, and rotate each one individually. It also collate pdfs and some other nice things. sudo apt install pdfshuffler


8

To improve output resolution (default is 72 DPI), I got good results with: convert -rotate -90 -density 200 input.pdf output.pdf This was for a .pdf of a scanned document. I found that -density 300 reduced quality somewhat versus -density 200.


8

I posted the same question in the Arch Linux forums and got the following embarrassingly simple answer. Just hit the "tab" button. You can then navigate the bookmarks with h, j, k, l (l and h drill down and collapse nested bookmarks, respectively).


4

Just use pdfgrep directly: pdfgrep -n therapy *.pdf The -n option will display the page number of each match.


4

Mupdf for example is not based on poppler.


3

You are correct that pdfsig is not in the poppler-utils that comes with 16.04. However, it is in poppler-utils from 16.10 and later. If the compile of poopler 0.65 completed successfully, you should be able to run pdfsig by giving the path to the compiled binary. You can probably find the path by running find . -type f | grep '/pdfsig$' in the poopler ...


3

I don't think you can use a signal. But Xpdf accepts synthetic events, so it's easy to programmatically type r into the window using xdotool(1). Unfortunately the xpdf window does not identify itself by its PID, but the following seems to work: xdotool search --onlyvisible --class Xpdf key r If you know the name of the file that Xpdf is displaying, you ...


3

This was the suggested solution by don_crissti, and I am providing an explanation of it here for users just getting started with Unix and Linux. Feel free to edit, as this summary was written by a novice. for f in *.pdf; do pdftotext "$f" "/path/to/some/dir/${f%.*}.txt"; done Now, let's examine each command. Here is a standard for loop that is used to ...


3

It wasn't a configuration snag, but a user interface snag: following links works while using the "Browse Tool" (Icon: mouse), but not while using the "Zoom Tool" (Icon: Looking glass over paper sheet) or the "Selection Tool" (Icon: pencil in corner of frame).


2

A function I use all the time to do exactly this. Just make sure the pdfs sort properly in sequence in the expansion. tp="/tmp/tmp.pdf" td="/tmp/data" for i in *.pdf; do echo "Bookmarking $i" printf "BookmarkBegin\nBookmarkTitle: %s\nBookmarkLevel: 1\nBookmarkPageNumber: 1\n" "${i%.*}"> "$td" pdftk "$i" update_info "$td" output "$tp" mv "$...


1

pdftoppm appears to provide the following scaling options: -scale-to number Scales the long side of each page (width for landscape pages, height for portrait pages) to fit in scale-to pixels. The size of the short side will be determined by the aspect ratio of the page. -scale-to-x number Scales ...


1

I use this command to automatically rotate pdf files to become upright down if they aren't upright in the first place : gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -dAutoRotatePages=/All -sOutputFile="$outputFile" "$file"


1

Although it does have its limitations, I quite often use PDFedit, especially for the rotation of PDF scans. While ImageMagick's convert (using rather high -density values) achieves quite a good quality, it also bloats the file (original: 155 kiB, 180° rotated copy: 1.2 MiB). PDFedit rotates the same image with unchanged quality without noticably changing the ...


1

Non-destructive version of @bu5hman's answer: #!/bin/bash out_file="combined.pdf" tmp_dir="/tmp/pdftk_unite" bookmarks_file="$tmp_dir/bookmarks.txt" bookmarks_fmt="BookmarkBegin BookmarkTitle: %s BookmarkLevel: 1 BookmarkPageNumber: 1 " rm -rf "$tmp_dir" mkdir -p "$tmp_dir" for f in *.pdf; do echo "Bookmarking $f..." title="${f%.*}" printf "$...


1

you could try this; pdfgrep therapy *.pdf or find /tmp -name '*.pdf' -exec pdfgrep test {} + eg; user@host $ pdfgrep test *.pdf 1.pdf:test1 1.pdf:test2 1.pdf:test3 2.pdf:test1 2.pdf:test2 2.pdf:test3 test (copy).pdf:test1 test (copy).pdf:test2 test (copy).pdf:test3 user@host $ find /tmp -name '*.pdf' -exec pdfgrep test {} + /tmp/test (copy).pdf:test1 ...


Only top voted, non community-wiki answers of a minimum length are eligible