Skip to content

Commit 8e68251

Browse files
author
xilopaint
committed
Improved merge feature
* Added ability to merge the selected PDF files without moving them to Trash. Use the `⌘` modifier key instead if you want to move them to Trash after merging.
1 parent 68988da commit 8e68251

12 files changed

+279
-105
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11

22
.DS_Store
3+
*.sublime-project
4+
*.sublime-workspace

Alfred PDF Tools.alfredworkflow

863 Bytes
Binary file not shown.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Download the workflow file from [GitHub releases][2] and install it by double-cl
1616

1717
* `Optimize`: Optimize the selected PDF files by entering the intended resolution of the output file (150 dpi is set once no value is input). The document will be improved on the process with increased contrast and text straightening;
1818
* `Encrypt`: Encrypt the selected PDF files by entering a password;
19-
* `Merge`: Merge the selected PDF files and move the source files to trash;
19+
* `Merge`: Merge the selected PDF files. Use the `` modifier key if you also want to move the source files to Trash;
2020
* `Split`: Split the selected PDF file either by page count or file size (use the `` modifier key in the latter case);
2121
* `Slice`: Slice the selected PDF file in multiple files by entering page numbers and/or page ranges separated by commas (e.g. 2, 5-8). For a single file/slice use the `` modifier key.
2222

src/encrypt.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import os
66
from PyPDF2 import PdfFileReader, PdfFileWriter
77

8+
89
def main():
910

1011
abs_path = os.environ['abs_path']
@@ -13,7 +14,7 @@ def main():
1314
no_ext_path = [os.path.splitext(x) for x in files]
1415
file_count = len(files)
1516

16-
for n in xrange (file_count):
17+
for n in xrange(file_count):
1718

1819
inp_file = open(files[n], 'rb')
1920
reader = PdfFileReader(inp_file, strict=False)
@@ -27,6 +28,7 @@ def main():
2728
writer.write(out_file)
2829
out_file.close()
2930

31+
3032
if __name__ == '__main__':
3133

3234
sys.exit(main())

0 commit comments

Comments
 (0)