Skip to content

How to Save Webpages as PDFs with a javascript iOS Bookmarklet

Photo Feb 18, 10 03 16 AM-1

I’m basically like a crazy digital squirrel who snatches up tasty bits from the internet and hides them in my information tree.

And saving webpages as pdf files on my iPhone and iPad was one nut I just couldn’t crack. Until now.

Let me show you how.

Wanted: PDFs

I’ve been looking for a simple way to save webpages as PDFs from the iOS Safari browser for quite some time. See, I use Evernote to store research, interesting tidbits, records, blog material, and just about everything else I’m interested in. The great thing about Evernote is that everything I save in it is searchable — including pdfs.

That’s why I wanted to do more than just email a webpage url which is the usual MO for sharing web content from Safari. I want to capture the text itself as a gloriously searchable pdf file that will look great and print well for years to come without the need for tedious copy and paste and without the aid of a computer.

Magical Javascript

I finally have a simple, handy solution. In a few easy steps, you can create a custom bookmarklet in iOS Safari that will do just what I always dreamed — take a webpage and convert it to pdf. It’s free. It’s easy. And it has this digital squirrel twitching with delight.

The secret is this little string of letters and symbols:

javascript:pdf_url=location.href;location.href=’http://api.
joliprint.com/api/rest/url/print/s/joliprint.com?
url=’+escape(pdf_url)+’&disposition=attachment’

It’s a javascript. A magical formula that we’re going trick iOS Safari into running for us to create pdfs.

A Few Simple Steps

Follow the easy steps below to create your own pdf maker bookmarklet. Before you jump into step one, copy the javascript above exactly  and send it to yourself in an email. That will make your task easier.

2 Comments Post a comment
  1. Thanks, Owen. As a note, I had to fiddle with the the copy and paste routine a few times because my iPhone didn’t want to render the “tiny single quote marks” correctly. So I had to manually re-add them. No problem.

    February 21, 2012
    • Yeah, a lot of times iOS Safari won’t handle JavaScript in bookmarks very well. Usually you can save the bookmark, then open it again and edit the JavaScript. After the second save, it usually works. :)

      February 21, 2012

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

You may use basic HTML in your comments. Your email address will not be published.

Subscribe to this comment feed via RSS

Follow

Get every new post delivered to your Inbox.

Join 42 other followers