Skip to content

davidambz/pdf-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PDF Manager

The PDF manager is a simple command-line PDF editor developed in Python.

How to install

Clone the repository:

  git clone git@github.com:davidspader/pdf-manager.git

Access the project directory:

  cd pdf-manager

You need the PyPDF2 library:

  pip install PyPDF2

How to use

There are two main required parameters: action and fileName, and a third parameter(used in some methods, each with its own purpose).

The PDF files that will be manipulated must be located in the ./pdfs folder. All new generated files will have the same name as the file edited with -new at the end.

How to run

  python3 index.py action fileName thirdParameter

GetAllPages

Each page will be transformed into a pdf file, they are in ./pdf/allPages:

  python3 index.py GetAllPages example.pdf

RemoveAllPagesFiles

Remove all files from ./pdf/allPages:

  python3 index.py RemoveAllPagesFiles noFile

This method doesn't need any files, so we use noFile.

GetFirstPage

Extracting only the first page:

  python3 index.py GetFirstPage example.pdf

GetFirstPage

Extracting only the last page:

  python3 index.py GetLastPage example.pdf

GetOnePage

Extracting any page:

  python3 index.py GetOnePage example.pdf 3

GetPages

Extracting multiple pages:

  python3 index.py GetPages example.pdf 1 2 4

You can pass to as a parameter to get a sequence of pages:

  python3 index.py GetPages example.pdf 1 to 4

After the file name example.pdf, the parameters will all be interpreted as pages.

You can use this function to sort the pages too:

  python3 index.py GetPages example.pdf 5 3 4 1 2

Now the page order is 5 3 4 1 2.

GetMerge

Join two pdfs:

  python3 index.py GetMerge example.pdf example2.pdf

GetRotatePages

To rotate the file:

  python3 index.py GetRotatePages example.pdf 90

The third parameter is the number of degrees that the file will rotate, it always has to be multiples of 90.

DeletePages

You can delete one or more pages:

  python3 index.py DeletePages example.pdf 1

deleting multiple pages:

  python3 index.py DeletePages example.pdf 1 3 5

You can also pass to as a parameter to get a sequence of pages to delete:

  python3 index.py DeletePages example.pdf 2 to 4

Author

About

pdf manager command line

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages