Skip to content

Commit

Permalink
Renamed to PDFsak
Browse files Browse the repository at this point in the history
  • Loading branch information
10b14224cc committed Oct 10, 2021
1 parent ca14dfa commit 3318db8
Show file tree
Hide file tree
Showing 16 changed files with 43 additions and 27 deletions.
34 changes: 25 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# pdftools
# PDFsak

## About it
pdftools is an utility to manipulate PDF files.
PDFsak (PDF Swiss Army knife) is an utility to manipulate PDF files.

The previous name of the project (as of 2021-10-10) was "pdftools".

It allows you to:

Expand All @@ -20,10 +22,20 @@ It allows you to:

Disover all the functionalities by running:

pdftools
pdfsak --help

## Installation

### From pip

Run:

```
pip3 install pdfsak
```

### From source

Clone the repository and run the install script:

```
Expand All @@ -32,17 +44,21 @@ cd pdftools
python3 setup.py install --user
```

A new command `pdftools` is now available in your PATH.
A new command `pdfsak` is now available in your PATH.

## Where can I find the examples?
## Examples

All the examples can be found in the `examples/scripts` directory.
All the examples can be found in the `examples/scripts` directory ([GitHub link](https://github.com/raffaem/pdftools/tree/master/examples/scripts)).

Take a look at this directory to learn how to achieve the above and more.

Also, check the help by running:

pdfsak --help

## GUI

pdftools currently has no GUI but only a CLI.
pdfsak currently has no GUI but only a CLI.

## Requirements

Expand All @@ -63,9 +79,9 @@ pdftools currently has no GUI but only a CLI.

* You can check the presence of the above required LaTeX packages by running:

`pdftools.py --check-latex`
`pdfsak --check-latex`

* [Ghostscript](https://www.ghostscript.com/) must be available through the `gs` command
* You can check its presence by running:

`pdftools.py --check-ghostscript`
`pdfsak --check-ghostscript`
2 changes: 1 addition & 1 deletion examples/scripts/addtext.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# - Page numbers in the bottom right corner (in the format `current_page/total_pages`)
# - Current date in the top left corner (in the format `day/month/year`)

../../pdftools --input-file ../input/article1.pdf --output ../output/addtext.pdf --text "\huge \$page/\$pages" br 1 1 --text "\huge \$day/\$month/\$year" tl 0 0 --overwrite
../../pdfsak --input-file ../input/article1.pdf --output ../output/addtext.pdf --text "\huge \$page/\$pages" br 1 1 --text "\huge \$day/\$month/\$year" tl 0 0 --overwrite
2 changes: 1 addition & 1 deletion examples/scripts/delete_pages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

# This example rotate the pages of a input PDF file

../../pdftools --input-file ../input/numbered.pdf --output ../output/delete_pages.pdf --overwrite --delete-pages "4,5,10,11"
../../pdfsak --input-file ../input/numbered.pdf --output ../output/delete_pages.pdf --overwrite --delete-pages "4,5,10,11"
2 changes: 1 addition & 1 deletion examples/scripts/extract_pages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

# This example extract the pages of a input PDF file

../../pdftools --input-file ../input/numbered.pdf --output ../output/extract_pages.pdf --extract-pages "1,3,20-"
../../pdfsak --input-file ../input/numbered.pdf --output ../output/extract_pages.pdf --extract-pages "1,3,20-"
4 changes: 2 additions & 2 deletions examples/scripts/handout2x2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# The left columns will contain pages from the input PDF file
# The right columns will be white

../../pdftools --input-file ../input/presentation.pdf --output ../output/handout2x2_W.pdf --add-white-pages --overwrite
../../pdfsak --input-file ../input/presentation.pdf --output ../output/handout2x2_W.pdf --add-white-pages --overwrite

../../pdftools --input-file ../output/handout2x2_W.pdf --output ../output/handout2x2.pdf --nup 2 2 --height 0.32 --landscape --frame --paper a4paper --overwrite
../../pdfsak --input-file ../output/handout2x2_W.pdf --output ../output/handout2x2.pdf --nup 2 2 --height 0.32 --landscape --frame --paper a4paper --overwrite

rm ../output/handout2x2_W.pdf
4 changes: 2 additions & 2 deletions examples/scripts/handout3x2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# The left columns will contain pages from the input PDF file
# The right columns will be white

../../pdftools --input-file ../input/presentation.pdf --output ../output/handout3x2_W.pdf --add-white-pages --overwrite
../../pdfsak --input-file ../input/presentation.pdf --output ../output/handout3x2_W.pdf --add-white-pages --overwrite

../../pdftools --input-file ../output/handout3x2_W.pdf --output ../output/handout3x2.pdf --nup 3 2 --height 0.2 --landscape --frame --paper a4paper
../../pdfsak --input-file ../output/handout3x2_W.pdf --output ../output/handout3x2.pdf --nup 3 2 --height 0.2 --landscape --frame --paper a4paper

rm ../output/handout3x2_W.pdf

2 changes: 1 addition & 1 deletion examples/scripts/img2pdf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

# This example creates a PDF from images

../../pdftools --input-file ../input/img1.jpg --input-file ../input/img2.jpg --paper A4 -o ../output/img2pdf.pdf
../../pdfsak --input-file ../input/img1.jpg --input-file ../input/img2.jpg --paper A4 -o ../output/img2pdf.pdf
2 changes: 1 addition & 1 deletion examples/scripts/merge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

# This example append 2 input PDF files together in a single output PDF file

../../pdftools --input-file ../input/article1.pdf --input-file ../input/article2.pdf --output ../output/merge.pdf
../../pdfsak --input-file ../input/article1.pdf --input-file ../input/article2.pdf --output ../output/merge.pdf
2 changes: 1 addition & 1 deletion examples/scripts/merge_dir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# This example merge together all the PDF files in a folder.
# Natural sorting is used to determine the order in which the files are merged.

../../pdftools --input-dir ../input/ --output ../output/merge_dir.pdf
../../pdfsak --input-dir ../input/ --output ../output/merge_dir.pdf
2 changes: 1 addition & 1 deletion examples/scripts/replace_input.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

cp ../input/numbered.pdf ../output/replace_input.pdf

../../pdftools --input-file ../output/replace_input.pdf --replace-input --extract-pages "1"
../../pdfsak --input-file ../output/replace_input.pdf --replace-input --extract-pages "1"
2 changes: 1 addition & 1 deletion examples/scripts/rotate_pages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

# This example rotate the pages of a input PDF file

../../pdftools --input-file ../input/numbered.pdf --output ../output/rotate_pages.pdf --overwrite --rotate-pages "2=90;3=180;4=270;5=45"
../../pdfsak --input-file ../input/numbered.pdf --output ../output/rotate_pages.pdf --overwrite --rotate-pages "2=90;3=180;4=270;5=45"
2 changes: 1 addition & 1 deletion examples/scripts/swap_pages_end.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

# This example swap the pages of an input PDF file

../../pdftools --input-file ../input/numbered.pdf --output ../output/swap_pages_end.pdf --swap-pages "31,32"
../../pdfsak --input-file ../input/numbered.pdf --output ../output/swap_pages_end.pdf --swap-pages "31,32"
2 changes: 1 addition & 1 deletion examples/scripts/swap_pages_middle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

# This example swap the pages of an input PDF file

../../pdftools --input-file ../input/numbered.pdf --output ../output/swap_pages_middle.pdf --swap-pages "2,3;4,5"
../../pdfsak --input-file ../input/numbered.pdf --output ../output/swap_pages_middle.pdf --swap-pages "2,3;4,5"
2 changes: 1 addition & 1 deletion examples/scripts/swap_pages_start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

# This example swap the pages of an input PDF file

../../pdftools --input-file ../input/numbered.pdf --output ../output/swap_pages_start.pdf --swap-pages "1,2;3,4"
../../pdfsak --input-file ../input/numbered.pdf --output ../output/swap_pages_start.pdf --swap-pages "1,2;3,4"
4 changes: 2 additions & 2 deletions pdftools → pdfsak
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def run(args):
# If NOT in debug, temporary directory is created in system temporary folder
if not args.debug:
#avoid out of scope
temp_dir = tempfile.TemporaryDirectory(prefix='pdftools').name
temp_dir = tempfile.TemporaryDirectory(prefix='pdfsak').name
# If in debug mode, temporary directory is created in current working directory
else:
temp_dir = os.path.join(os.getcwd(), args.debug_folder)
Expand Down Expand Up @@ -560,7 +560,7 @@ def main(cmdargs):
# A mutually exclusive group to specify the output file name OR a suffix to append to the first input file name
output_group = parser.add_mutually_exclusive_group()
output_group.add_argument('-o', '--output', help=u'Output filename')
output_group.add_argument('--out-suffix', help=u'Suffix to add to the first input filename to obtain the output filename', default='_pdftools')
output_group.add_argument('--out-suffix', help=u'Suffix to add to the first input filename to obtain the output filename', default='_pdfsak')
output_group.add_argument('--replace-input', action='store_true', default=False,
help=u'Replace first input PDF file with output PDF file.')

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
scripts=['./pdftools'],
scripts=['./pdfsak'],
python_requires=">=3.6",
)

0 comments on commit 3318db8

Please sign in to comment.