pypdf cli

2025-12-11 0 734

PYPDF-CLI


命令行工具基于单击和PYPDF。它允许访问大多数PYPDF的功能,并添加其他明智的功能。目的是提供独立于OS的CLI,该CLI允许每天舒适的PDF操纵。

下载

需要python> = 3.6

  • 在本地建造:

    • 克隆这个存储库
    • Python -M PIP安装
  • 从PYPI安装:

    • Python -M PIP安装PYPDF -CLI

用法

pypdfcli [options]命令[args] …

pypdf-cli命令-HELP了解命令的选项。

命令 描述
解密 用密码解密PDF文件
删除 从PDF文件中删除一部分页面。
加密 使用用户和可选的所有者密码加密PDF文件。
提炼 从PDF文件中提取页面选择。
信息 打印有关PDF文件的信息。
插入 将第二个PDF文件插入指定索引的PDF文件中。
合并 合并两个或多个PDF文件。
消除 从PDF文件中删除图像,链接或文本。
撤销 反转PDF文件的页面。
旋转 旋转PDF文件的页面选择。
规模 缩放PDF文件的页面选择。
分裂 将PDF文件拆分为指定的索引。

命令

解密

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.

删除

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.

加密

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.

提炼

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.

信息

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.

插入

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.

合并

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.

消除

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.

撤销

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.

旋转

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.

规模

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.

分裂

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.

下载源码

通过命令行克隆项目:

git clone https://github.com/Tobi208/pypdf-cli.git

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

申明:本文由第三方发布,内容仅代表作者观点,与本网站无关。对本文以及其中全部或者部分内容的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。本网发布或转载文章出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,也不代表本网对其真实性负责。

左子网 建站资源 pypdf cli https://www.zuozi.net/35065.html

ksedit
上一篇: ksedit
FF_PugiXml
下一篇: FF_PugiXml
常见问题
  • 1、自动:拍下后,点击(下载)链接即可下载;2、手动:拍下后,联系卖家发放即可或者联系官方找开发者发货。
查看详情
  • 1、源码默认交易周期:手动发货商品为1-3天,并且用户付款金额将会进入平台担保直到交易完成或者3-7天即可发放,如遇纠纷无限期延长收款金额直至纠纷解决或者退款!;
查看详情
  • 1、描述:源码描述(含标题)与实际源码不一致的(例:货不对板); 2、演示:有演示站时,与实际源码小于95%一致的(但描述中有”不保证完全一样、有变化的可能性”类似显著声明的除外); 3、发货:不发货可无理由退款; 4、安装:免费提供安装服务的源码但卖家不履行的; 5、收费:价格虚标,额外收取其他费用的(但描述中有显著声明或双方交易前有商定的除外); 6、其他:如质量方面的硬性常规问题BUG等。 注:经核实符合上述任一,均支持退款,但卖家予以积极解决问题则除外。
查看详情
  • 1、左子会对双方交易的过程及交易商品的快照进行永久存档,以确保交易的真实、有效、安全! 2、左子无法对如“永久包更新”、“永久技术支持”等类似交易之后的商家承诺做担保,请买家自行鉴别; 3、在源码同时有网站演示与图片演示,且站演与图演不一致时,默认按图演作为纠纷评判依据(特别声明或有商定除外); 4、在没有”无任何正当退款依据”的前提下,商品写有”一旦售出,概不支持退款”等类似的声明,视为无效声明; 5、在未拍下前,双方在QQ上所商定的交易内容,亦可成为纠纷评判依据(商定与描述冲突时,商定为准); 6、因聊天记录可作为纠纷评判依据,故双方联系时,只与对方在左子上所留的QQ、手机号沟通,以防对方不承认自我承诺。 7、虽然交易产生纠纷的几率很小,但一定要保留如聊天记录、手机短信等这样的重要信息,以防产生纠纷时便于左子介入快速处理。
查看详情

相关文章

猜你喜欢
发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务