|
|
#1 |
|
Prospect
Join Date: Jul 2002
Location: FLA
Posts: 49
|
wkpdf Automator
Hi,
I found this great command line tool wkpdf for taking web pages and saving it as a pdf. The advantage of this to the built in print to pdf are that it can pint the web page without page breaks. (--paginate no) I built an Automator action to handle HTML files I have downloaded and convert to pdf. Pretty simple to do: Application receives files and folders as input Run shell script [/bin/bash Pass input: as arguments] Code:
#! /bin/bash for file in "$@" do wkpdf --source "$file" --print-background yes --paginate no --output "$file".pdf done So I figured well why not make an Automator service that will work directly from within Firefox (or any web browser or application) So I set up: Service recieves selected URLs in any application input is only URLs Run shell script [/bin/bash Pass input: as arguments] Code:
mkdir -p ~/Documents/SavedHTML cd ~/Documents/SavedHTML wkpdf --source "$@" --print-background yes --paginate no --output "$@".pdf I've tried every combination of "service receives..." I can think of. I've only been able to make it work in safari if I first save the url via action and then pass to the shell script. Problem is I prefer Firefox so this solution, aside from being clunky since it saves the html aslo, wont work for me.Anyone out there that can offer some assistance? Last edited by MVasilakis; 11-17-2011 at 09:44 AM. |
|
|
|
|
|
#2 |
|
Hall of Famer
Join Date: Apr 2007
Posts: 4,262
|
My guess would be that $@ is being interpreted as an array (even though there's only one file). try using the for loop like you do in your original example, or try using $1 instead of $@ - either should get the desired URL out of the list of parameters.
__________________
Philosophy is a battle against the bewitchment of our intelligence by means of language. -LW- |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|