IT/Software/Command Line Applications/PDF Tools: Difference between revisions
Walttheboss (talk | contribs) No edit summary |
Walttheboss (talk | contribs) (Added some tools) |
||
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
==Here is a short list of the many many pdf tools in the Linux toolbox== | ==Here is a short list of the many many pdf tools in the Linux toolbox== | ||
==== pdftk has been around | ====pdftk==== | ||
This tool has been around forever and will not go away. Which is good. | |||
Example: Rip out even or odd pages pages | |||
==== pdfjam ==== | <code>pdftk name.pdf cat 1-endeven output even.pdf </code> | ||
<code>pdftk name.pdf cat 1-endodd output odd.pdf </code> | |||
Example: Join the odd and even documents into one. | |||
<code>pdftk odd-crop.pdf even-crop.pdf shuffle output nameMargins.pdf</code> | |||
====pdfcrop==== | |||
The most common use is just to remove white space from a document formatted for a different page size. | |||
<code>pdfcrop input.pdf output.pdf</code> | |||
You don't even have to specify the output name. It will make a new name with crop in it. | |||
When you print form Okular you need to select Force Rasterization. Otherwise it "remembers" the cropped margins! | |||
Example: Here we add a margin of 30 mm to the left | |||
Order is left, bottom, right, top | |||
<code>pdfcrop --margins "30 0 0 0" odd.pdf </code> | |||
The above works well if you have a scanned image that fills every page the same. | |||
However if you don't you need to readjust the bbox | |||
<code>pdfcrop --verbose filename.pdf</code> | |||
Now you know the existing bbox. | |||
Adjust with | |||
<code>pdfcrop --bbox '57 77 579 700' filename.pdf</code> | |||
Play with the numbers with the document open in Okular. You will see the results. | |||
This will help printing with GUIs like Okular and Evince. | |||
It messes up lp and lpr | |||
====pdfjam==== | |||
Example: Create a pdf for printing with margins of 1 cm on left by pushing document to the right. | Example: Create a pdf for printing with margins of 1 cm on left by pushing document to the right. | ||
pdfjam --twoside 20.pdf --offset '1cm 0cm' --suffix 'offset'Example | <code>pdfjam --twoside 20.pdf --offset '1cm 0cm' --suffix 'offset'Example</code> | ||
<br /> | |||
==== pdfdetach ==== | |||
This can detach all attached files. Does not include annotations. | |||
some MSG pdf files have audio attached as annotations | |||
==== qpdf ==== | |||
this can decrypt files that are password protected with a blank password | |||
Or just really old pdf files. | |||
qpdf --decrypt chap01.pdf chap01_B.pdf<br /> |
Latest revision as of 13:57, 25 September 2024
Here is a short list of the many many pdf tools in the Linux toolbox
pdftk
This tool has been around forever and will not go away. Which is good.
Example: Rip out even or odd pages pages
pdftk name.pdf cat 1-endeven output even.pdf
pdftk name.pdf cat 1-endodd output odd.pdf
Example: Join the odd and even documents into one.
pdftk odd-crop.pdf even-crop.pdf shuffle output nameMargins.pdf
pdfcrop
The most common use is just to remove white space from a document formatted for a different page size.
pdfcrop input.pdf output.pdf
You don't even have to specify the output name. It will make a new name with crop in it.
When you print form Okular you need to select Force Rasterization. Otherwise it "remembers" the cropped margins!
Example: Here we add a margin of 30 mm to the left
Order is left, bottom, right, top
pdfcrop --margins "30 0 0 0" odd.pdf
The above works well if you have a scanned image that fills every page the same.
However if you don't you need to readjust the bbox
pdfcrop --verbose filename.pdf
Now you know the existing bbox.
Adjust with
pdfcrop --bbox '57 77 579 700' filename.pdf
Play with the numbers with the document open in Okular. You will see the results.
This will help printing with GUIs like Okular and Evince.
It messes up lp and lpr
pdfjam
Example: Create a pdf for printing with margins of 1 cm on left by pushing document to the right.
pdfjam --twoside 20.pdf --offset '1cm 0cm' --suffix 'offset'Example
pdfdetach
This can detach all attached files. Does not include annotations.
some MSG pdf files have audio attached as annotations
qpdf
this can decrypt files that are password protected with a blank password
Or just really old pdf files.
qpdf --decrypt chap01.pdf chap01_B.pdf