Yesterday I download few good webpages from the net on stochastic methods. They were really good. Instead of going to the web pages again and again I downloaded them for offline use.
Unfortunately did all this on my home, personal laptop. Now I needed a mechanism to transfer the web pages via email. Sending webpage is a pain. Sometime the images are missing or some script stops responding. They never look the same when viewed in other system.
The best solution was to have the webpages converted to pdf’s and get them to office. I knew about automator on Mac that can make my life easier and help convert these 25+ odd pages to PDF.
After an hour-long tinkering, number of laborious work around, I finally got this done with a simple script in the terminal.
The ease with this was done prompted me to share the technique.
It’s elegant and super quick. I used the cupsfilter to get all my HTML docs converted to PDF.
Here’s the script.
for file in *.htm; do filename=$(basename “$file”); /usr/sbin/cupsfilter “$file” > “$filename.pdf”; done
Yes open terminal. Navigate to the folder containing the HTML files and then write the above loop and you are done.
Now how do I automate sending 25+ emails with attachment? That’s for some other day.Follow @aerogeek