xilopaint

Alfred PDF Tools – Optimize, encrypt and manipulate PDF files

18 posts in this topic

Alfred PDF Tools


A workflow for Alfred 3


Description


Optimize, encrypt and manipulate PDF files.

Download and Installation

Download the workflow file from GitHub releases and install it by double-clicking on Alfred PDF Tools.alfredworklow.


Usage


Alfred PDF Tools can be used by the following file actions:

 

  • Optimize: Compress and 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;
  • Encrypt: Encrypt the selected PDF files by entering a password;

  • Merge: Merge the selected PDF files and move the source files to trash;
  • Split by Page Count: Split the selected PDF file by entering the maximum amount of pages for each new PDF file;
  • Split by File Size: Split the selected PDF file by entering the maximum file size in MB for each new PDF file;
  • Slice:  Slice the selected PDF file by entering start, stop and step arguments separated by commas (e.g., "10, 20, 1" will create a PDF file from pages 10 to 20 of the source file).


Contribute


To report a bug or submit a feature request, please create an issue or submit a pull request on GitHub.


Credits


This workflow relies on PyPDF2 library currently maintained by Phaseit, Inc., K2pdfopt by Johannes Buchnerand, Send2Trash by Virgil Dupras and OneUpdater by Vítor Galvão.


License


Alfred PDF Tools code is released under the MIT License.

 

 

Edited by xilopaint
designjoe likes this

Share this post


Link to post

Update (v1.1.1):

 

Added ability to set the output filename when merging files.

Edited by xilopaint

Share this post


Link to post

Update (v1.1.2):

 

Fixed a bug in Merge file action that may cause the output file is moved to trash when its name is identical to any of the input filenames.

Share this post


Link to post

Update (v1.1.3):

 

Fixed a bug that could create an empty output file when merging certain PDF files.

Share this post


Link to post

Posted (edited)

Update (v2.0):

 

This is a major update. Now Alfred PDF Tools can optimize and compress PDF files. This release also added an auto-update feature.

Edited by xilopaint

Share this post


Link to post
4 hours ago, xilopaint said:

Update (v2.1):

 

Added ability to encrypt PDF files.

Could make the flow to accept multiple files? Thanks you 

Share this post


Link to post

I have set my keywords and see the action in Alfred but it does nothing to the pdf files I select in the finder before invoking Alfred. What am I doing wrong? Thanks for any help.

Share this post


Link to post

Posted (edited)

32 minutes ago, alwaysaugust said:

I have set my keywords and see the action in Alfred but it does nothing to the pdf files I select in the finder before invoking Alfred. What am I doing wrong? Thanks for any help.

 

You should not set any keyword or do any other change to make the workflow work. Revert back your changes or reinstall the workflow. Alfred PDF Tools is fully operated by file actions, so you just have to select one or more PDF files with Alfred, depending on the chosen action, and enter the user input once requested. The keyword elements are intended to get user input, not to trigger the action.

Edited by xilopaint

Share this post


Link to post

Posted (edited)

On 4/21/2017 at 0:23 PM, 2pilvic said:

Could make the flow to accept multiple files? Thanks you 

 

I have concerns regarding the stability. In larger files the workflow needs more time to complete the encryption process so a batch encryption could not be as stable. In any case I will consider your request and make some tests to check if this can be implemented in a reliable way.

Edited by xilopaint

Share this post


Link to post

Thank you, I am new to Alfred and was not properly selecting the files to invoke Alfred and your workflow. Thanks so much this is just what I needed.

Share this post


Link to post

Posted (edited)

1 hour ago, alwaysaugust said:

Thank you, I am new to Alfred and was not properly selecting the files to invoke Alfred and your workflow. Thanks so much this is just what I needed.

 

No problem. Feel free to ask any question or request a feature.

Edited by xilopaint

Share this post


Link to post

Can you explain the step part of the input when slicing? Can I split a 10-page pdf into 3 ranges like 1-2 3-4 5-8 and get 3 files with a single input argument?

Share this post


Link to post
15 hours ago, alwaysaugust said:

Can you explain the step part of the input when slicing? Can I split a 10-page pdf into 3 ranges like 1-2 3-4 5-8 and get 3 files with a single input argument?

 

If you enter 1,20,1 for start, stop, step you will have all pages from 1 to 20 of the source file.


If you enter 1,20,2 you will include the start page and every page after a step of two pages so you will have in the output file the following pages of the source file: 1, 3, 5, 7, 9, 11, 13, 15, 17, 19.

 

If you enter 1,20,4 you have a step of four pages so the output file will have the following pages of the source file: 1, 5, 9, 13, 17. Note that the difference between the pages is equal to the step value (eg. 5 - 1 = 4; 9 - 5 = 4 and so on).

 

15 hours ago, alwaysaugust said:

Can I split a 10-page pdf into 3 ranges like 1-2 3-4 5-8 and get 3 files with a single input argument?

 

No. According the workflow logic a split should involve all pages of the source file. You are mentioning a multiple slice invoked by a single input argument. This is not supported by Alfred PDF Tools and I am not certain it would be a useful feature. Personally, when I need to do this I prefer to use Finder for dragging the pages in order to create multiple documents.

Edited by xilopaint

Share this post


Link to post

My use case is I get pages of invoices which can range from 1-4 pages each within the larger 10-15 page pdf. I only need to keep/process some of them so I usually look at the page numbers I need like 1,2,4-5,6,8-10,13 and then use ilovepdf.com's split tool to set up the needed ranges and it pops x number of files in a zip (annoying part I hate the zip).

 

What I was hoping APT could do was take an arguement like "slice 1,2,4-5,6,8-10,13" and have it spit out the 6 files into the source directory with some default naming scheme that includes the pg numbers for reference. Potenitally with an aruguement like "slice 1,2,4-5; [single:multi]" where multi slices into 3 files and single slices out the input pages and then combines those 3 files back into a single pdf.

 

I understand this is a limited need function. I really appreciate your tool and communication.

Share this post


Link to post
18 minutes ago, alwaysaugust said:

What I was hoping APT could do was take an arguement like "slice 1,2,4-5,6,8-10,13" and have it spit out the 6 files into the source directory with some default naming scheme that includes the pg numbers for reference. Potenitally with an aruguement like "slice 1,2,4-5; [single:multi]" where multi slices into 3 files and single slices out the input pages and then combines those 3 files back into a single pdf.

 

It sounds interesting. I will look into this in the coming weeks.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now