Utility to perform commands on PDF files
Project description
PDFCMD - Utility to Perform Commands on PDF Files
This is a Linux command line utility to perform commands on PDF files. It uses the PyPDF2 library. The following commands are presently implemented, each as an independent plugin.
usage: pdfcmd [-h] {info,help,cat,pages} ...
Utility to perform commands on PDF files.
positional arguments:
{info,help,cat,pages}
Available commands:
info Show PDF document information.
help Show help/usage for this utility.
cat Concaternate selected pages of one or more PDF files
into a single file.
pages Output list of page labels/numbers, or total number of
pages.
options:
-h, --help show this help message and exit
info command
usage: pdfcmd info [-h] file
Show PDF document information.
positional arguments:
file PDF file
options:
-h, --help show this help message and exit
help command
usage: pdfcmd help [-h]
Show help/usage for this utility.
options:
-h, --help show this help message and exit
cat command
usage: pdfcmd cat [-h] [-o OUTFILE] ...
Concaternate selected pages of one or more PDF files into a single file.
positional arguments:
fileranges Sequence of alternating file names and page ranges
options:
-h, --help show this help message and exit
-o OUTFILE, --outfile OUTFILE
output file, default = stdout
Arguments are specified as a sequence of alternating file names and page
ranges:
file1 pagerange1 file2 pagerange2 ..
Page ranges refer to the previously specified file and are specified in
Python "slice" notation, assuming each page is like an element in a
sequence, starting at 0.
For example, concatenate all of head.pdf, all but page seven of
content.pdf, and the last page of tail.pdf, producing output.pdf:
pdfcmd cat -o output.pdf head.pdf content.pdf :6 7: tail.pdf -1
A file not followed by a page range means all pages of that file, for
example:
pdfcmd cat chapter*.pdf >book.pdf
You can also assign a single upper case "alias" to a file at first use
and then use that alias later as shorthand. For example, output the
first page from document1.pdf, the first page of document2.pdf, then
the remaining pages from document1.pdf and document2.pdf:
pdfcmd cat -o output.pdf A=document1.pdf 0 B=document2.pdf 0 A 1: B 1:
Page range expression examples (remember, page indices start with zero):
: all pages. -1 last page.
22 just the 23rd page. :-1 all but the last page.
0:3 the first three pages. -2 second-to-last page.
:3 the first three pages. -2: last two pages.
5: from the sixth page onward. -3:-1 third & second to last.
The third, "stride" or "step" number is also recognized.
::2 0 2 4 ... to the end. 3:0:-1 3 2 1 but not 0.
1:10:2 1 3 5 7 9 2::-1 2 1 0.
::-1 all pages in reverse order.
pages command
usage: pdfcmd pages [-h] [-c] file
Output list of page labels/numbers, or total number of pages.
positional arguments:
file PDF file
options:
-h, --help show this help message and exit
-c, --count just print the total count of pages
The latest documentation and code is available at https://github.com/bulletmark/pdfcmd.
INSTALLATION
Arch Linux users can install pdfcmd from the
AUR.
Python 3.6 or later is required. Note pdfcmd is on
PyPI so just ensure that
python3-pip and python3-wheel are installed then type the following
to install (or upgrade):
$ sudo pip3 install -U pdfcmd
Alternatively, do the following to install from the source repository.
Note that the python-pypdf2 package is required.
$ git clone http://github.com/bulletmark/pdfcmd
$ cd pdfcmd
$ sudo pip3 install -U .
UPGRADE
$ cd pdfcmd # Source dir, as above
$ git pull
$ sudo pip3 install -U .
REMOVAL
$ sudo pip3 uninstall pdfcmd
LICENSE
Copyright (C) 2021 Mark Blakeney. This program is distributed under the terms of the GNU General Public License. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License at http://www.gnu.org/licenses/ for more details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pdfcmd-1.5.tar.gz.
File metadata
- Download URL: pdfcmd-1.5.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.1 pkginfo/1.8.3 requests/2.28.1 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.10.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d059fffceaa841a18987df15928561f1c54b338125c53e6c22bf2f1ee0e7157
|
|
| MD5 |
85791792f9479541772275e9473623f5
|
|
| BLAKE2b-256 |
29ac848f22b09558a4dcb394b541023a65c8ce484e5d1e027d7d609099bc5195
|
File details
Details for the file pdfcmd-1.5-py3-none-any.whl.
File metadata
- Download URL: pdfcmd-1.5-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.1 pkginfo/1.8.3 requests/2.28.1 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.10.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d8bbc2d01843fdde682c574544947094ea03f3e3dc266110fa661fe6f1ab9c0
|
|
| MD5 |
c0ade646d4e7df4d361bb6932ed21a35
|
|
| BLAKE2b-256 |
74a50d11f4d6b5c32d44b002d8414e130ab466193893f7d6127f7659e0f4bd53
|