Jump to content

[SOLVED] File action to place 2 pages on 1

Recommended Posts

Posted (edited)



I build a shell script using pdftk and pdfjam to arrange a PDF file as 2 pages on 1 (same page on left and right of the new page):

#! bin/bash

outfile=${fullfile/.pdf/ (2 auf 1).pdf}

/opt/local/bin/pdftk A="$fullfile" B="$fullfile" shuffle A1-end B1-end output ~/.temp/out.pdf

/Library/TeX/texbin/pdfjam --nup 2x1 ~/.temp/out.pdf --landscape --a4paper --outfile "$outfile"

rm ~/.temp/out.pdf

It works fine if I call ist from the Terminal like this:

sh 2on1_test.sh ~/Desktop/2-auf-1/a3h.pdf

But it doesn't work as part of my file action in Alfred. I set up the Script to use argv. When using the script I only get the Notification but no new PDF file. You can find the workflow here: https://tf.tobiw.de/2on1.alfredworkflow


I’m using Alfred v3.8 [959] with macOS 10.14.3 on a MacBook Pro 2016.


I hope you can help me what I did wrong or what I can do to debug this …





Edited by TobiW

Share this post

Link to post

I found a solution myself: pdfjam itself calls another program which wasn’t found. So to solve this I added 

export PATH="/opt/local/bin:/opt/local/sbin:/Library/TeX/texbin/:$PATH"

at the beginning of the script.

Share this post

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...