0

How can we write an alfred workflow to reduce the size of selected pdf files in the Finder?

So far, I have created a simple mac application using Automator. This application needs to be opened first, then select the pdf file from the path, and the reduced pdf will be copied to another path.

Problem:
I have to first open the app, then go the path of pdf, select it, and then it will be created in another directory.

Needed:
Select a pdf in Finder, reduced sized pdf will be created in the same directory with a different name using Alfred workflow. How can we do so?

The link to Automator application and Alfred workflow can be found here:

Automator app and alfred workflows in github

The snap shots are included below: enter image description here enter image description here

  • You should ask this question on the Apple focused StackExchange [Ask Different](https://apple.stackexchange.com)… there's already quite a few [Alfred questions](https://apple.stackexchange.com/questions/tagged/alfred) – Craig Apr 30 '18 at 00:07

1 Answers1

1

You can use the Optimize file action of Alfred PDF Tools.

Disclosure: I'm the workflow author.

xilopaint
  • 699
  • 1
  • 7
  • 16
  • Thanks, however, the usage it little bit ambiguous. I tried this like this: selected pdf in finder, opened Alfred, assigned keyword optimize to optimize, optimize, given scale 20, however it did nothing except showing notifications file was successfully optimized! –  May 02 '18 at 14:27
  • Revert your changes. `Optimize` is not a keyword, it's a file action. If you're not familiar with Alfred you can read [here](https://www.alfredapp.com/blog/tips-and-tricks/file-actions-from-alfred-or-finder/) how to perform file actions. – xilopaint May 02 '18 at 14:33
  • Thanks, I got it now, can we select multiple files and move them to File Action. What I did was search for a pdf in alfred, right arrow to put on file action, the use Optimize file action, it works but, can we select files from finder ? –  May 02 '18 at 14:41
  • Have you read the link in my comment? Your question is answered there. – xilopaint May 02 '18 at 14:44
  • I guess I just glossed over the details, its easy to select multiple files, select the files in finder, and cmd-alt-\ then apply the file action. –  May 02 '18 at 14:47
  • This time I got reduced size pdf for 106MB to 28 MB, but it could not be opened. Error Failed to load PDF document. (it looks like pdf, but can not be opened) –  May 02 '18 at 14:48
  • What resolution have you used? – xilopaint May 02 '18 at 14:52
  • I used resolution 100, it did not work for one pdf I tried but worked for another pdf (170MB to 52.6MB). The workflow works and I specially I like the Progressbar You have created. Great Work! I hope the workflow works for most of the pdfs, I have not tried too many pdfs, only two till now, but it worked for one and failed for another. –  May 02 '18 at 14:56
  • It should work for most of your PDF files. In general a corrupted output PDF is derived from a malformed PDF. Also, you can open an issue on GitHub and share the offending PDF file for further investigation. – xilopaint May 02 '18 at 15:06
  • Sure! I will raise an issue in github repo. –  May 02 '18 at 15:09