Jump to content

Alfred PDF Tools – Optimize, encrypt and manipulate PDF files

Recommended Posts



Re-downloaded. No more errors, but Mergin PDF command does nothing.


### Workflow version

### Alfred version

### Python version

### PyCryptodome version
Not Installed

### Rosetta installation status

### macOS version

### Architecture

Link to comment
4 hours ago, xilopaint said:

@slyfox I need the Alfred Debugger output as well.


[22:10:12.341] Logging Started...
[22:10:30.863] Alfred PDF Tools[File Action] Processing complete
[22:10:30.875] Alfred PDF Tools[File Action] Passing output '(
)' to Arg and Vars
[22:10:30.877] Alfred PDF Tools[Arg and Vars] Processing complete
[22:10:30.878] Alfred PDF Tools[Arg and Vars] Passing output '' to Keyword
[22:10:32.307] Alfred PDF Tools[Keyword] Processing complete
[22:10:32.308] Alfred PDF Tools[Keyword] Passing output 'May' to Run Script
[22:10:32.575] ERROR: Alfred PDF Tools[Run Script] .
22:10:32 workflow.py:2332 DEBUG    ---------- Alfred PDF Tools (4.3.1) ----------
22:10:32 workflow.py:1692 DEBUG    reading settings from /Users/ivan/Library/Application Support/Alfred/Workflow Data/com.xilopaint.alfredapp.pdftools/settings.json
22:10:32 workflow.py:2737 DEBUG    update check not due
22:10:32 workflow.py:2352 ERROR    'NumberObject' object has no attribute 'indirect_reference'
Traceback (most recent call last):
  File "/Users/ivan/Library/Mobile Documents/com~apple~CloudDocs/Alfred/Alfred.alfredpreferences/workflows/user.workflow.C5A658BE-E81B-480E-BBF0-A024BF54E903/workflow/workflow.py", line 2346, in run
  File "/Users/ivan/Library/Mobile Documents/com~apple~CloudDocs/Alfred/Alfred.alfredpreferences/workflows/user.workflow.C5A658BE-E81B-480E-BBF0-A024BF54E903/alfred_pdf_tools.py", line 583, in main
    merge(query, pdf_paths)
  File "/Users/ivan/Library/Mobile Documents/com~apple~CloudDocs/Alfred/Alfred.alfredpreferences/workflows/user.workflow.C5A658BE-E81B-480E-BBF0-A024BF54E903/alfred_pdf_tools.py", line 80, in wrapper
    func(*args, **kwargs)
  File "/Users/ivan/Library/Mobile Documents/com~apple~CloudDocs/Alfred/Alfred.alfredpreferences/workflows/user.workflow.C5A658BE-E81B-480E-BBF0-A024BF54E903/alfred_pdf_tools.py", line 301, in merge
  File "/Users/ivan/Library/Mobile Documents/com~apple~CloudDocs/Alfred/Alfred.alfredpreferences/workflows/user.workflow.C5A658BE-E81B-480E-BBF0-A024BF54E903/pypdf/_writer.py", line 2659, in append
  File "/Users/ivan/Library/Mobile Documents/com~apple~CloudDocs/Alfred/Alfred.alfredpreferences/workflows/user.workflow.C5A658BE-E81B-480E-BBF0-A024BF54E903/pypdf/_utils.py", line 442, in wrapper
    return func(*args, **kwargs)
  File "/Users/ivan/Library/Mobile Documents/com~apple~CloudDocs/Alfred/Alfred.alfredpreferences/workflows/user.workflow.C5A658BE-E81B-480E-BBF0-A024BF54E903/pypdf/_writer.py", line 2755, in merge
    elif dest["/Page"].indirect_reference.idnum in srcpages:
AttributeError: 'NumberObject' object has no attribute 'indirect_reference'
22:10:32 workflow.py:2355 INFO     for assistance, see: https://github.com/xilopaint/alfred-pdf-tools
22:10:32 workflow.py:2376 DEBUG    ---------- finished in 0.021s ----------


Link to comment
  • 2 weeks later...

Update (v4.4)

What’s Changed

  • New icon.
  • Enhanced performance for Optimize and Deskew file actions on Apple Silicon.
  • Dropped support for Optimize and Deskew actions on Intel Macs.
  • Improved Merge file action, allowing the first selected PDF document’s filename to be used for the output PDF file with an appended suffix.


Full Changelog:


Edited by xilopaint
Link to comment

I’ve dropped support for Optimize and Deskew on Intel Macs. This might change if someone came up with a Homebrew formula for k2pdfopt which would not only allow full compatibility with Intel architecture, but also with Alfred Gallery.

Edited by xilopaint
Link to comment
  • 5 months later...

Hi there.


Trying to install this workflow on my M3 Macbook Pro.


As per the workflow page the last line states: "This workflow relies on pypdf library by Martin Thoma, docopt by Vladimir Keleshev and K2pdfopt by willus."


I have installed pypdf with:

$ brew install pymupdf


I have installed docopt with:

$ brew install python-docopt


But I'm stuck with installing K2pdfopt. I have downloaded the corresponding arm file and done a chmod 755 to it to make it executable but don't know how to point Alfred PDF Tools to it...


Any help appreciated.



Edited by jl_al
Link to comment
  • 3 months later...
Posted (edited)
On 9/6/2022 at 12:16 AM, Dylzzz said:

Hi @xilopaint, looks like you have a great workflow here. I am fairly new so I'm not sure whats possible.

As per my first post:

 I would love to know if its possible to do text extraction from PDF's

Text extraction support has been added.

Edited by xilopaint
Link to comment

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
  • Create New...