pdfcmd


Namepdfcmd JSON
Version 1.10 PyPI version JSON
download
home_pageNone
SummaryUtility to perform commands on PDF files
upload_time2024-04-22 06:53:15
maintainerNone
docs_urlNone
authorNone
requires_python>=3.6
licenseGPLv3
keywords pdf pypdf
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## PDFCMD - Utility to Perform Commands on PDF Files
[![PyPi](https://img.shields.io/pypi/v/pdfcmd)](https://pypi.org/project/pdfcmd/)
[![AUR](https://img.shields.io/aur/version/pdfcmd)](https://aur.archlinux.org/packages/pdfcmd/)

This is a Linux command line utility to perform commands on PDF files.
It uses the [pypdf](https://github.com/py-pdf/pypdf) library. The
following commands are presently implemented, each as an independent
[plugin](pdfcmd/commands).

The latest documentation and code is available at
https://github.com/bulletmark/pdfcmd.

## Usage

Type `pdfcmd` or `pdfcmd -h` to view the usage summary:

```
usage: pdfcmd [-h] {cat,help,info,pages} ...

Utility to perform commands on PDF files.

options:
  -h, --help            show this help message and exit

Commands:
  {cat,help,info,pages}
    cat                 Concaternate selected pages of one or more PDF files
                        into a single file.
    help                Show help/usage for this utility.
    info                Show PDF document information.
    pages               Output list of page labels/numbers, or total number of
                        pages.
```

Type `pdfcmd <command> -h` to see specific help/usage for any
individual command:

### Command `cat`

```
usage: pdfcmd cat [-h] [-o OUTFILE] [-a] ...

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
  -a, --no-aliases      do not use aliases

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" name 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.
```

### Command `info`

```
usage: pdfcmd info [-h] file

Show PDF document information.

positional arguments:
  file        PDF file

options:
  -h, --help  show this help message and exit
```

### Command `pages`

```
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
```

### Command `help`

```
usage: pdfcmd help [-h]

Show help/usage for this utility.

options:
  -h, --help  show this help message and exit
```

## Installation

Arch Linux users can install [pdfcmd from the
AUR](https://aur.archlinux.org/packages/pdfcmd). Python 3.6 or later is
required. Note [pdfcmd is on PyPI](https://pypi.org/project/pdfcmd/) so
just ensure that [`pipx`](https://pypa.github.io/pipx/) is installed
then type the following:

```
$ pipx install pdfcmd
```

To upgrade:

```
$ pipx upgrade pdfcmd
```

## Command Line Tab Completion

Command line shell [tab
completion](https://en.wikipedia.org/wiki/Command-line_completion) is
automatically enabled on `pdfcmd` commands and options using
[`argcomplete`](https://github.com/kislyuk/argcomplete). You may need to
first (once-only) [activate argcomplete global
completion](https://github.com/kislyuk/argcomplete#global-completion).

## 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.

<!-- vim: se ai syn=markdown: -->

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pdfcmd",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "PDF, pypdf",
    "author": null,
    "author_email": "Mark Blakeney <mark.blakeney@bullet-systems.net>",
    "download_url": "https://files.pythonhosted.org/packages/88/c2/44ada272922b98f933d8d3a463c6246faf733484c409f3b96697f1b634fb/pdfcmd-1.10.tar.gz",
    "platform": null,
    "description": "## PDFCMD - Utility to Perform Commands on PDF Files\n[![PyPi](https://img.shields.io/pypi/v/pdfcmd)](https://pypi.org/project/pdfcmd/)\n[![AUR](https://img.shields.io/aur/version/pdfcmd)](https://aur.archlinux.org/packages/pdfcmd/)\n\nThis is a Linux command line utility to perform commands on PDF files.\nIt uses the [pypdf](https://github.com/py-pdf/pypdf) library. The\nfollowing commands are presently implemented, each as an independent\n[plugin](pdfcmd/commands).\n\nThe latest documentation and code is available at\nhttps://github.com/bulletmark/pdfcmd.\n\n## Usage\n\nType `pdfcmd` or `pdfcmd -h` to view the usage summary:\n\n```\nusage: pdfcmd [-h] {cat,help,info,pages} ...\n\nUtility to perform commands on PDF files.\n\noptions:\n  -h, --help            show this help message and exit\n\nCommands:\n  {cat,help,info,pages}\n    cat                 Concaternate selected pages of one or more PDF files\n                        into a single file.\n    help                Show help/usage for this utility.\n    info                Show PDF document information.\n    pages               Output list of page labels/numbers, or total number of\n                        pages.\n```\n\nType `pdfcmd <command> -h` to see specific help/usage for any\nindividual command:\n\n### Command `cat`\n\n```\nusage: pdfcmd cat [-h] [-o OUTFILE] [-a] ...\n\nConcaternate selected pages of one or more PDF files into a single file.\n\npositional arguments:\n  fileranges            Sequence of alternating file names and page ranges\n\noptions:\n  -h, --help            show this help message and exit\n  -o OUTFILE, --outfile OUTFILE\n                        output file, default = stdout\n  -a, --no-aliases      do not use aliases\n\nArguments are specified as a sequence of alternating file names and page\nranges:\n\n  file1 pagerange1 file2 pagerange2 ..\n\nPage ranges refer to the previously specified file and are specified in\nPython \"slice\" notation, assuming each page is like an element in a\nsequence, starting at 0.\n\nFor example, concatenate all of head.pdf, all but page seven of\ncontent.pdf, and the last page of tail.pdf, producing output.pdf:\n\n  pdfcmd cat -o output.pdf head.pdf content.pdf :6 7: tail.pdf -1\n\nA file not followed by a page range means all pages of that file, for\nexample:\n\n  pdfcmd cat chapter*.pdf >book.pdf\n\nYou can also assign a single upper case \"alias\" name to a file at first\nuse and then use that alias later as shorthand. For example, output the\nfirst page from document1.pdf, the first page of document2.pdf, then the\nremaining pages from document1.pdf and document2.pdf:\n\n  pdfcmd cat -o output.pdf A=document1.pdf 0 B=document2.pdf 0 A 1: B 1:\n\nPage range expression examples (remember, page indices start with zero):\n      :     all pages.                   -1    last page.\n      22    just the 23rd page.          :-1   all but the last page.\n      0:3   the first three pages.       -2    second-to-last page.\n      :3    the first three pages.       -2:   last two pages.\n      5:    from the sixth page onward.  -3:-1 third & second to last.\n  The third, \"stride\" or \"step\" number is also recognized.\n      ::2       0 2 4 ... to the end.    3:0:-1    3 2 1 but not 0.\n      1:10:2    1 3 5 7 9                2::-1     2 1 0.\n      ::-1      all pages in reverse order.\n```\n\n### Command `info`\n\n```\nusage: pdfcmd info [-h] file\n\nShow PDF document information.\n\npositional arguments:\n  file        PDF file\n\noptions:\n  -h, --help  show this help message and exit\n```\n\n### Command `pages`\n\n```\nusage: pdfcmd pages [-h] [-c] file\n\nOutput list of page labels/numbers, or total number of pages.\n\npositional arguments:\n  file         PDF file\n\noptions:\n  -h, --help   show this help message and exit\n  -c, --count  just print the total count of pages\n```\n\n### Command `help`\n\n```\nusage: pdfcmd help [-h]\n\nShow help/usage for this utility.\n\noptions:\n  -h, --help  show this help message and exit\n```\n\n## Installation\n\nArch Linux users can install [pdfcmd from the\nAUR](https://aur.archlinux.org/packages/pdfcmd). Python 3.6 or later is\nrequired. Note [pdfcmd is on PyPI](https://pypi.org/project/pdfcmd/) so\njust ensure that [`pipx`](https://pypa.github.io/pipx/) is installed\nthen type the following:\n\n```\n$ pipx install pdfcmd\n```\n\nTo upgrade:\n\n```\n$ pipx upgrade pdfcmd\n```\n\n## Command Line Tab Completion\n\nCommand line shell [tab\ncompletion](https://en.wikipedia.org/wiki/Command-line_completion) is\nautomatically enabled on `pdfcmd` commands and options using\n[`argcomplete`](https://github.com/kislyuk/argcomplete). You may need to\nfirst (once-only) [activate argcomplete global\ncompletion](https://github.com/kislyuk/argcomplete#global-completion).\n\n## LICENSE\n\nCopyright (C) 2021 Mark Blakeney. This program is distributed under the\nterms of the GNU General Public License.\nThis program is free software: you can redistribute it and/or modify it\nunder the terms of the GNU General Public License as published by the\nFree Software Foundation, either version 3 of the License, or any later\nversion.\nThis program is distributed in the hope that it will be useful, but\nWITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General\nPublic License at <http://www.gnu.org/licenses/> for more details.\n\n<!-- vim: se ai syn=markdown: -->\n",
    "bugtrack_url": null,
    "license": "GPLv3",
    "summary": "Utility to perform commands on PDF files",
    "version": "1.10",
    "project_urls": {
        "Homepage": "https://github.com/bulletmark/pdfcmd"
    },
    "split_keywords": [
        "pdf",
        " pypdf"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "41451dfd4ac3f97e3a99e5125d0d634afd23640293e4a27f0fd32295582d7021",
                "md5": "f75d7017f2d14df22968742b79ccd1aa",
                "sha256": "b099138f109f2748623618011f5858fdc34b6abf7b1a36eb14e6d4f6b3a715a6"
            },
            "downloads": -1,
            "filename": "pdfcmd-1.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f75d7017f2d14df22968742b79ccd1aa",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 8235,
            "upload_time": "2024-04-22T06:53:13",
            "upload_time_iso_8601": "2024-04-22T06:53:13.186828Z",
            "url": "https://files.pythonhosted.org/packages/41/45/1dfd4ac3f97e3a99e5125d0d634afd23640293e4a27f0fd32295582d7021/pdfcmd-1.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "88c244ada272922b98f933d8d3a463c6246faf733484c409f3b96697f1b634fb",
                "md5": "24bebff4bcffa5106d3958dcd6cb32b8",
                "sha256": "ce926e3ea81dba2b1fd9bfede30c08e85c4d79e232d030f881d90db7c6a7b0cd"
            },
            "downloads": -1,
            "filename": "pdfcmd-1.10.tar.gz",
            "has_sig": false,
            "md5_digest": "24bebff4bcffa5106d3958dcd6cb32b8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 8021,
            "upload_time": "2024-04-22T06:53:15",
            "upload_time_iso_8601": "2024-04-22T06:53:15.172059Z",
            "url": "https://files.pythonhosted.org/packages/88/c2/44ada272922b98f933d8d3a463c6246faf733484c409f3b96697f1b634fb/pdfcmd-1.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-22 06:53:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "bulletmark",
    "github_project": "pdfcmd",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pdfcmd"
}
        
Elapsed time: 0.30545s