pypdf-cli


Namepypdf-cli JSON
Version 1.0.1 PyPI version JSON
download
home_pageNone
SummaryA Python-based CLI that allows for comfortable every-day PDF manipulation with pypdf.
upload_time2024-05-08 12:23:01
maintainerNone
docs_urlNone
authorNone
requires_python>=3.6
licenseNone
keywords pdf cli pypdf click
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pypdf-cli

------------

This command line tool is based on [click](https://github.com/pallets/click) and [pypdf](https://github.com/py-pdf/pypdf).
It allows access to most of pypdf's functionalities and adds other sensible functionalities.
The aim is to provide an OS-independent CLI that allows for comfortable every-day PDF manipulation.

## Download

Requires **python >= 3.6**

* Build locally:
  * Clone this repository
  * ``python -m pip install .``

* Install from [PyPi](https://pypi.org/project/pypdf-cli/):
  * ``python -m pip install pypdf-cli``

## Usage

``pypdf-cli [OPTIONS] COMMAND [ARGS]...``

``pypdf-cli COMMAND --help`` to learn about a command's options.

| Command | Description                                                    |
|---------|----------------------------------------------------------------|
| decrypt | Decrypt a pdf file with a password.                            |
| delete  | Delete a selection of pages from a pdf file.                   |
| encrypt | Encrypt a pdf file with a user and optional owner password.    |
| extract | Extract a selection of pages from a pdf file.                  |
| info    | Print information about a pdf file.                            |
| insert  | Insert a second pdf file into a pdf file at a specified index. |
| merge   | Merge two or more pdf files.                                   |
| remove  | Remove images, links, or text from a pdf file.                 |
| reverse | Reverse the pages of a pdf file.                               |
| rotate  | Rotate a selection of pages of a pdf file.                     |
| scale   | Scale a selection of pages of a pdf file.                      |
| split   | Split a pdf file at specified indices.            

## Commands

### decrypt
```
Usage: pypdf-cli decrypt [OPTIONS] INPUT_FILE

  Decrypt a pdf file with a password.

  INPUT_FILE is the location of the pdf file you wish to decrypt.

Options:
  -o, --output PATH  Optional location of the output pdf file. WARNING:
                     overwrites existing files.
  --password TEXT    The password to match.  [required]
  --help             Show this message and exit.

```

### delete
```
Usage: pypdf-cli delete [OPTIONS] INPUT_FILE

  Delete a selection of pages from a pdf file.

  INPUT_FILE is the location of the pdf file you wish to delete pages from.

Options:
  -p, --select-pages INT PAGES  Selection of pages. Enter list of integers and
                                ranges without spaces or wrap in quotation
                                marks. E.g. 1,3-5,7.
  -o, --output PATH             Optional location of the output pdf file.
                                WARNING: overwrites existing files.
  --help                        Show this message and exit.

```

### encrypt
```
Usage: pypdf-cli encrypt [OPTIONS] INPUT_FILE

  Encrypt a pdf file with a user and optional owner password. If no owner
  password is passed, it is the same as the user password.

  INPUT_FILE is the location of the pdf file you wish to encrypt.

Options:
  -o, --output PATH      Optional location of the output pdf file. WARNING:
                         overwrites existing files.
  --user-password TEXT   Allows for opening and reading the PDF file with the
                         restrictions provided.  [required]
  --owner-password TEXT  Allows for opening the PDF files without any
                         restrictions.                By default, the owner
                         password is the same as the user password.
  --use-40bit            Whether to use 40bit encryption. When false, 128bit
                         encryption will be used.
  --help                 Show this message and exit.

```

### extract
```
Usage: pypdf-cli extract [OPTIONS] INPUT_FILE

  Extract a selection of pages from a pdf file.

  INPUT_FILE is the location of the pdf file you wish to extract pages from.

Options:
  -p, --select-pages INT PAGES  Selection of pages. Enter list of integers and
                                ranges without spaces or wrap in quotation
                                marks. E.g. 1,3-5,7.
  -o, --output PATH             Optional location of the output pdf file.
                                WARNING: overwrites existing files.
  --help                        Show this message and exit.

```

### info
```
Usage: pypdf-cli info [OPTIONS] INPUT_FILE

  Print information about a pdf file.

  INPUT_FILE is the location of the pdf file you wish to get information of.

Options:
  --help  Show this message and exit.

```

### insert
```
Usage: pypdf-cli insert [OPTIONS] INPUT_FILES...

  Insert a second pdf file into a pdf file at a specified index. The new pdf
  file will contain the second file's pages starting at the index.

  INPUT_FILES 1. is the location of the pdf file you want to insert the second
  into. INPUT_FILES 2. is the location of the pdf file you want to insert into
  the first.

Options:
  -o, --output PATH             Optional location of the output pdf file.
                                WARNING: overwrites existing files.
  -p, --select-pages INT PAGES  Selection of page. Enter integer. E.g. 2.
                                [required]
  --help                        Show this message and exit.

```

### merge
```
Usage: pypdf-cli merge [OPTIONS] [INPUT_FILES]...

  Merge two or more pdf files. Files are appended in the order they are
  entered.

  INPUT_FILES are the locations of at least two pdf files to be merged.

Options:
  -o, --output PATH   Optional location of the output pdf file. WARNING:
                      overwrites existing files.
  -a, --all           Select every index.
  -s, --sort SORT BY  Sort input files by NAME or DATE (last modified) when
                      selecting all files.
  --help              Show this message and exit.

```

### remove
```
Usage: pypdf-cli remove [OPTIONS] INPUT_FILE

  Remove images, links, or text from a pdf file.

  INPUT_FILE is the location of the pdf file you wish to remove images, links,
  or text from.

Options:
  -o, --output PATH  Optional location of the output pdf file. WARNING:
                     overwrites existing files.
  --images           Whether to remove images.
  --links            Whether to remove links.
  --text             Whether to remove text.
  --help             Show this message and exit.

```

### reverse
```
Usage: pypdf-cli reverse [OPTIONS] INPUT_FILE

  Reverse the pages of a pdf file.

  INPUT_FILE is the location of the pdf file you wish to reverse.

Options:
  -o, --output PATH  Optional location of the output pdf file. WARNING:
                     overwrites existing files.
  --help             Show this message and exit.

```

### rotate
```
Usage: pypdf-cli rotate [OPTIONS] INPUT_FILE

  Rotate a selection of pages of a pdf file.

  INPUT_FILE is the location of the pdf file you wish to rotate.

Options:
  -p, --select-pages INT PAGES  Selection of pages. Enter list of integers and
                                ranges without spaces or wrap in quotation
                                marks. E.g. 1,3-5,7.
  -o, --output PATH             Optional location of the output pdf file.
                                WARNING: overwrites existing files.
  -a, --all                     Select every index.
  --angle INTEGER               Angle to rotate pages clockwise. Must be
                                increment of 90.  [required]
  --help                        Show this message and exit.

```

### scale
```
Usage: pypdf-cli scale [OPTIONS] INPUT_FILE

  Scale a selection of pages of a pdf file. Uses scaleBy by default. Use
  --scale-to to scale to a flat value.

  INPUT_FILE is the location of the pdf file you wish to scale.

Options:
  -p, --select-pages INT PAGES  Selection of pages. Enter list of integers and
                                ranges without spaces or wrap in quotation
                                marks. E.g. 1,3-5,7.
  -o, --output PATH             Optional location of the output pdf file.
                                WARNING: overwrites existing files.
  -a, --all                     Select every index.
  --scale-to                    Whether to change width and height of pages to
                                a flat value.
  --horizontal FLOAT            Horizontal factor or value to scale pages by
                                or to.  [required]
  --vertical FLOAT              Vertical factor or value to scale pages by or
                                to.  [required]
  --help                        Show this message and exit.

```

### split
```
Usage: pypdf-cli split [OPTIONS] INPUT_FILE

  Split a pdf file at specified indices. The file is split AFTER a specified
  index. E.g. pages = {1, 2, 3, 4} and indices = [2, 3] results in {1, 2},
  {3}, and {4}. That means an index needs to be lower than the number of
  pages. The output files are numerated as <output>_1.pdf, <output>_2.pdf,
  etc.

  INPUT_FILE is the location of the pdf file you want to split.

Options:
  -p, --select-pages INT PAGES  Selection of pages. Enter list of integers and
                                ranges without spaces or wrap in quotation
                                marks. E.g. 1,3-5,7.
  -o, --output PATH             Optional location of the output pdf file.
                                WARNING: overwrites existing files.
  -a, --all                     Select every index.
  --help                        Show this message and exit.

```


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pypdf-cli",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "pdf, cli, pypdf, click",
    "author": null,
    "author_email": "Tobias Lass <tobi208@github.com>",
    "download_url": "https://files.pythonhosted.org/packages/43/e5/43b0377970cd3464e2c777d2588852442411b926794be8699fc8923aaaae/pypdf_cli-1.0.1.tar.gz",
    "platform": null,
    "description": "# pypdf-cli\n\n------------\n\nThis command line tool is based on [click](https://github.com/pallets/click) and [pypdf](https://github.com/py-pdf/pypdf).\nIt allows access to most of pypdf's functionalities and adds other sensible functionalities.\nThe aim is to provide an OS-independent CLI that allows for comfortable every-day PDF manipulation.\n\n## Download\n\nRequires **python >= 3.6**\n\n* Build locally:\n  * Clone this repository\n  * ``python -m pip install .``\n\n* Install from [PyPi](https://pypi.org/project/pypdf-cli/):\n  * ``python -m pip install pypdf-cli``\n\n## Usage\n\n``pypdf-cli [OPTIONS] COMMAND [ARGS]...``\n\n``pypdf-cli COMMAND --help`` to learn about a command's options.\n\n| Command | Description                                                    |\n|---------|----------------------------------------------------------------|\n| decrypt | Decrypt a pdf file with a password.                            |\n| delete  | Delete a selection of pages from a pdf file.                   |\n| encrypt | Encrypt a pdf file with a user and optional owner password.    |\n| extract | Extract a selection of pages from a pdf file.                  |\n| info    | Print information about a pdf file.                            |\n| insert  | Insert a second pdf file into a pdf file at a specified index. |\n| merge   | Merge two or more pdf files.                                   |\n| remove  | Remove images, links, or text from a pdf file.                 |\n| reverse | Reverse the pages of a pdf file.                               |\n| rotate  | Rotate a selection of pages of a pdf file.                     |\n| scale   | Scale a selection of pages of a pdf file.                      |\n| split   | Split a pdf file at specified indices.            \n\n## Commands\n\n### decrypt\n```\nUsage: pypdf-cli decrypt [OPTIONS] INPUT_FILE\n\n  Decrypt a pdf file with a password.\n\n  INPUT_FILE is the location of the pdf file you wish to decrypt.\n\nOptions:\n  -o, --output PATH  Optional location of the output pdf file. WARNING:\n                     overwrites existing files.\n  --password TEXT    The password to match.  [required]\n  --help             Show this message and exit.\n\n```\n\n### delete\n```\nUsage: pypdf-cli delete [OPTIONS] INPUT_FILE\n\n  Delete a selection of pages from a pdf file.\n\n  INPUT_FILE is the location of the pdf file you wish to delete pages from.\n\nOptions:\n  -p, --select-pages INT PAGES  Selection of pages. Enter list of integers and\n                                ranges without spaces or wrap in quotation\n                                marks. E.g. 1,3-5,7.\n  -o, --output PATH             Optional location of the output pdf file.\n                                WARNING: overwrites existing files.\n  --help                        Show this message and exit.\n\n```\n\n### encrypt\n```\nUsage: pypdf-cli encrypt [OPTIONS] INPUT_FILE\n\n  Encrypt a pdf file with a user and optional owner password. If no owner\n  password is passed, it is the same as the user password.\n\n  INPUT_FILE is the location of the pdf file you wish to encrypt.\n\nOptions:\n  -o, --output PATH      Optional location of the output pdf file. WARNING:\n                         overwrites existing files.\n  --user-password TEXT   Allows for opening and reading the PDF file with the\n                         restrictions provided.  [required]\n  --owner-password TEXT  Allows for opening the PDF files without any\n                         restrictions.                By default, the owner\n                         password is the same as the user password.\n  --use-40bit            Whether to use 40bit encryption. When false, 128bit\n                         encryption will be used.\n  --help                 Show this message and exit.\n\n```\n\n### extract\n```\nUsage: pypdf-cli extract [OPTIONS] INPUT_FILE\n\n  Extract a selection of pages from a pdf file.\n\n  INPUT_FILE is the location of the pdf file you wish to extract pages from.\n\nOptions:\n  -p, --select-pages INT PAGES  Selection of pages. Enter list of integers and\n                                ranges without spaces or wrap in quotation\n                                marks. E.g. 1,3-5,7.\n  -o, --output PATH             Optional location of the output pdf file.\n                                WARNING: overwrites existing files.\n  --help                        Show this message and exit.\n\n```\n\n### info\n```\nUsage: pypdf-cli info [OPTIONS] INPUT_FILE\n\n  Print information about a pdf file.\n\n  INPUT_FILE is the location of the pdf file you wish to get information of.\n\nOptions:\n  --help  Show this message and exit.\n\n```\n\n### insert\n```\nUsage: pypdf-cli insert [OPTIONS] INPUT_FILES...\n\n  Insert a second pdf file into a pdf file at a specified index. The new pdf\n  file will contain the second file's pages starting at the index.\n\n  INPUT_FILES 1. is the location of the pdf file you want to insert the second\n  into. INPUT_FILES 2. is the location of the pdf file you want to insert into\n  the first.\n\nOptions:\n  -o, --output PATH             Optional location of the output pdf file.\n                                WARNING: overwrites existing files.\n  -p, --select-pages INT PAGES  Selection of page. Enter integer. E.g. 2.\n                                [required]\n  --help                        Show this message and exit.\n\n```\n\n### merge\n```\nUsage: pypdf-cli merge [OPTIONS] [INPUT_FILES]...\n\n  Merge two or more pdf files. Files are appended in the order they are\n  entered.\n\n  INPUT_FILES are the locations of at least two pdf files to be merged.\n\nOptions:\n  -o, --output PATH   Optional location of the output pdf file. WARNING:\n                      overwrites existing files.\n  -a, --all           Select every index.\n  -s, --sort SORT BY  Sort input files by NAME or DATE (last modified) when\n                      selecting all files.\n  --help              Show this message and exit.\n\n```\n\n### remove\n```\nUsage: pypdf-cli remove [OPTIONS] INPUT_FILE\n\n  Remove images, links, or text from a pdf file.\n\n  INPUT_FILE is the location of the pdf file you wish to remove images, links,\n  or text from.\n\nOptions:\n  -o, --output PATH  Optional location of the output pdf file. WARNING:\n                     overwrites existing files.\n  --images           Whether to remove images.\n  --links            Whether to remove links.\n  --text             Whether to remove text.\n  --help             Show this message and exit.\n\n```\n\n### reverse\n```\nUsage: pypdf-cli reverse [OPTIONS] INPUT_FILE\n\n  Reverse the pages of a pdf file.\n\n  INPUT_FILE is the location of the pdf file you wish to reverse.\n\nOptions:\n  -o, --output PATH  Optional location of the output pdf file. WARNING:\n                     overwrites existing files.\n  --help             Show this message and exit.\n\n```\n\n### rotate\n```\nUsage: pypdf-cli rotate [OPTIONS] INPUT_FILE\n\n  Rotate a selection of pages of a pdf file.\n\n  INPUT_FILE is the location of the pdf file you wish to rotate.\n\nOptions:\n  -p, --select-pages INT PAGES  Selection of pages. Enter list of integers and\n                                ranges without spaces or wrap in quotation\n                                marks. E.g. 1,3-5,7.\n  -o, --output PATH             Optional location of the output pdf file.\n                                WARNING: overwrites existing files.\n  -a, --all                     Select every index.\n  --angle INTEGER               Angle to rotate pages clockwise. Must be\n                                increment of 90.  [required]\n  --help                        Show this message and exit.\n\n```\n\n### scale\n```\nUsage: pypdf-cli scale [OPTIONS] INPUT_FILE\n\n  Scale a selection of pages of a pdf file. Uses scaleBy by default. Use\n  --scale-to to scale to a flat value.\n\n  INPUT_FILE is the location of the pdf file you wish to scale.\n\nOptions:\n  -p, --select-pages INT PAGES  Selection of pages. Enter list of integers and\n                                ranges without spaces or wrap in quotation\n                                marks. E.g. 1,3-5,7.\n  -o, --output PATH             Optional location of the output pdf file.\n                                WARNING: overwrites existing files.\n  -a, --all                     Select every index.\n  --scale-to                    Whether to change width and height of pages to\n                                a flat value.\n  --horizontal FLOAT            Horizontal factor or value to scale pages by\n                                or to.  [required]\n  --vertical FLOAT              Vertical factor or value to scale pages by or\n                                to.  [required]\n  --help                        Show this message and exit.\n\n```\n\n### split\n```\nUsage: pypdf-cli split [OPTIONS] INPUT_FILE\n\n  Split a pdf file at specified indices. The file is split AFTER a specified\n  index. E.g. pages = {1, 2, 3, 4} and indices = [2, 3] results in {1, 2},\n  {3}, and {4}. That means an index needs to be lower than the number of\n  pages. The output files are numerated as <output>_1.pdf, <output>_2.pdf,\n  etc.\n\n  INPUT_FILE is the location of the pdf file you want to split.\n\nOptions:\n  -p, --select-pages INT PAGES  Selection of pages. Enter list of integers and\n                                ranges without spaces or wrap in quotation\n                                marks. E.g. 1,3-5,7.\n  -o, --output PATH             Optional location of the output pdf file.\n                                WARNING: overwrites existing files.\n  -a, --all                     Select every index.\n  --help                        Show this message and exit.\n\n```\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A Python-based CLI that allows for comfortable every-day PDF manipulation with pypdf.",
    "version": "1.0.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/tobi208/pypdf-cli/issues",
        "Homepage": "https://github.com/tobi208/pypdf-cli"
    },
    "split_keywords": [
        "pdf",
        " cli",
        " pypdf",
        " click"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "494e96326b2f2f63ddeb5c10f37f4698168567118e3cde049fb860682407d5e3",
                "md5": "970840af4bcd0b304c9b3cc405105522",
                "sha256": "ba335e4fd13022525d7ebc56469efc3bd573e29f8998d2a4e97ec2d7d69a799a"
            },
            "downloads": -1,
            "filename": "pypdf_cli-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "970840af4bcd0b304c9b3cc405105522",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 20178,
            "upload_time": "2024-05-08T12:22:59",
            "upload_time_iso_8601": "2024-05-08T12:22:59.827820Z",
            "url": "https://files.pythonhosted.org/packages/49/4e/96326b2f2f63ddeb5c10f37f4698168567118e3cde049fb860682407d5e3/pypdf_cli-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "43e543b0377970cd3464e2c777d2588852442411b926794be8699fc8923aaaae",
                "md5": "7442401ea778ff6b7e740a5007094dc6",
                "sha256": "b94dc15409119a18d2b80665e42c79f478defa88cd2d5d6941d7356714bb8298"
            },
            "downloads": -1,
            "filename": "pypdf_cli-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "7442401ea778ff6b7e740a5007094dc6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 19906,
            "upload_time": "2024-05-08T12:23:01",
            "upload_time_iso_8601": "2024-05-08T12:23:01.978437Z",
            "url": "https://files.pythonhosted.org/packages/43/e5/43b0377970cd3464e2c777d2588852442411b926794be8699fc8923aaaae/pypdf_cli-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-08 12:23:01",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tobi208",
    "github_project": "pypdf-cli",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pypdf-cli"
}
        
Elapsed time: 0.23759s