Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

MPCodeWriter21/PDF-Helper

Open more actions menu

Repository files navigation

PDF-Helper

A simple python package that helps with doing simple stuff with PDFs.

Features

  • Bundle: Bundle multiple files into one PDF
    • PDF inputs
    • Image inputs (e.g. PNG, JPG, etc.)
    • Markdown inputs
  • Merge PDFs: Merge multiple PDFs into one PDF
  • Split PDFs: Split a PDF into multiple PDFs, each containing a range of pages from the original PDF
  • Export as image: Export designated pages from a PDF as image files
  • Remove pages: Remove designated pages from a PDF
  • Encrypt a PDF
  • Decrypt a PDF
  • Add watermark to a PDF
  • Extract images from a PDF
  • Extract text: Export text from a PDF file and optionally save it to a text file
  • Extract links from a PDF

If you want any other feature to be added, feel free to open an issue or fork the repo and make a pull request after adding your contribution.

Usage

Installation

You can install PDF-Helper via pip:

pip install pdf-helper

# Or use uv to install the tool
uv tool install pdf-helper

And run it using the command line:

pdf-helper <command> [options]

Or you can use uvx to run the package without installing it in a specific python environment:

uvx pdf-helper <command> [options]

You can also clone the repository and use uv run:

git clone https://github.com/MPCodeWriter21/PDF-Helper.git
cd PDF-Helper
uv run pdf-helper <command> [options]

Bundle PDFs

Bundle multiple files into one PDF:

pdf-helper bundle <input_file_1> <input_file_2>... <input_file_n> <output_file>

# E.g. Merge PDFs 1, 2 and 3 into a new PDF
pdf-helper merge 1.pdf 2.pdf 3.pdf new.pdf

# E.g. Take 1.png, 2.jpg, and 3.png and create a PDF named 123.pdf and override
# if already exists
pdf-helper bundle 1.png 2.jpg 3.png 123.pdf -f

# E.g. Take part1.pdf, image1.png, ending.pdf and bundle them into a PDF named final.pdf
pdf-helper bundle part1.pdf image1.png ending.pdf final.pdf -v

Split PDFs

Split a PDF into multiple PDFs, each containing a range of pages:

pdf-helper split <input_file> <output_folder> -s <split_point_1>,<split_point_2>

# E.g. Split a PDF into three PDFs, one with pages 1-10, the second with pages 11-20 and
# the third with pages 21-end
pdf-helper split my-pdf.pdf my-split-pdfs -s 10,20

# E.g. Split a PDF into PDFs each containing one page
pdf-helper split my-pdf.pdf my-split-pdfs  # No need to specify split points

Export PDF pages as image files

Export PDF pages as image files:

pdf-helper to-image <input_file> <output_folder> \
        -p <page_number_1>,<page_number_2>,...,<page_number_n> -s <scale_factor>

# E.g. Export pages 1, 2, 3 and 6 from a PDF with scale factor 1
pdf-helper to-image 1.pdf images -p 1-3,6 -s 1

# E.g. Export all pages from a PDF with scale 2
pdf-helper to-image my-pdf.pdf my-images

Remove pages from a PDF

Remove pages from a PDF:

pdf-helper remove-pages <input_file> <output_file> <page_number_1>,<page_number_2>,...,<page_number_n>

# E.g. Remove pages 1, 2, 3 and 6 from a PDF
pdf-helper remove-pages 1.pdf new.pdf 1-3,6

Export text from a PDF

To extract text from a PDF file and export them to text files you can do as follows:

pdf-helper extract-text <input_file> -o <output_file_name>

# E.g. Extract text from a PDF named my-pdf.pdf and save it to my-text.txt
pdf-helper extract-text my-pdf.pdf -o my-text.txt

About

Author: CodeWriter21

GitHub: MPCodeWriter21/PDF-Helper

Donations

Your donations are very welcome: nowpayments.io

You can also consider donating a Star to the repo.

License

This project is licensed under the MIT License.

See the LICENSE

References

About

A simple python script that helps with doing simple stuff with PDFs.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.