How to Save Web Pages as PDF Files on the iPad & iPhone

May 18, 2013 - 13 Comments

PDF icon One little feature that iOS really needs is the ability to natively “print to PDF” directly on the iPad and iPhone, a popular trick on the Mac and in the PC world that allows you to digitally print anything and, in this case, save the contents of any web document or web page as a self-contained PDF document, allowing it to be read later, printed, or used for whatever other purpose. Since this great feature isn’t around on the iPhone and iPad at the moment, we can use a nice bookmarklet trick combined with a free third party web service to be able to add a “Save as PDF” option to Safari in iOS, which allows you to ‘print’ or convert any web page to a PDF file that is then accessible to apps like iBooks. Let’s walk through the process of setting this up:

1: Create a “Print to PDF” Bookmarklet in Safari

First we’ll create a bookmarklet that provides the PDF conversion service, this is easy and free:

  • Open Safari and go to any web page – this one doesn’t matter, it’s going to be modified anyway
  • Copy the following javascript text exactly as it appears so that it resides in the iOS clipboard:
  • javascript:pdf_url=location.href;location.href='http://pdfmyurl.com?url='+escape(pdf_url)

  • Tap the Share button (it looks like a square with an arrow coming out of it) and then choose “Bookmark”, name the bookmark something like “Save as PDF” or “Convert to PDF” and choose “Save” – ignore the URL for now
  • Convert a webpage to PDF in iOS Safari by using a bookmarklet

  • Now tap the Bookmarks button, and tap the Bookmarks tab at the bottom, and now choose the “Edit” button
  • Modify the bookmark to turn it into a PDF bookmarklet

  • Select the “Convert to PDF” bookmark you just created/saved and then tap into the URL feed
  • Delete the existing URL, paste in the javascript code you copied in the first step, making sure it appears exactly as intended
  • The Save a webpage as PDF bookmarklet in Safari

  • Tap “Done” and then close out of the bookmarks menu

Creating the bookmarklet is now finished and you are ready to use it.

Optional Web-to-PDF Converter URL: Though there shouldn’t be any issues with the above javascript and PDF conversion service, we’ are going to provide an alternative web-to-PDF conversion Javascript just in case the aforementioned one stops working or is problematic for you.

javascript:void(window.open('http://www.web2pdfconvert.com/convert.aspx?cURL='+escape(location.href)))

Everything is otherwise the same, except that this uses a different service, and the javascript will launch the converted webpage into a new window where it can then be saved. In testing, they both worked the same and thus we don’t have a preference one way or another, but considering they are free services there could be some limitations on one and not the other that we don’t know about. Anyway, use whichever you like.

2: Saving the Web Page as a PDF

Now to save a webpage as PDF all you need to do is visit the webpage you want to save as a PDF document, then select the bookmarklet that was just created.

  • Visit any web page (OSXDaily.com is always a good one, right?) and now pull down the Bookmarks menu and choose the “Convert to PDF” bookmarklet you created to instantly convert the web page to a PDF file
  • Use the "Convert to PDF" in iPad Safari

  • Select “Open in iBooks” to save the webpages PDF into the iBooks library, or choose “Open In” to select another destination app
  • Save the PDF to iBooks

iBooks will launch and you’ll then have direct access to the webpage as a PDF file stored locally on the iOS device. If the document is multipage, it’ll be broken up into unique pages with thumbnail browsing access.

A webpage saved to iBooks as a PDF file

Depending on how often you use this, you may want to set the Bookmarks bar to always be visible in Safari on the iPad, thus allowing you to always have access to the “Print PDF” bookmarklet that was created. The only real downside to showing the bookmarks bar all the time is a slight reduction in available viewing space of webpages, and it does clutter the screen slightly.

Don’t forget to check out some other helpful bookmarklets for iOS, each of which can be used to add some great features that are currently missing from Safari.

.

Related articles:

Posted by: Paul Horowitz in iPad, iPhone, Tips & Tricks

13 Comments

» Comments RSS Feed

  1. Doug says:

    Gentlemen,

    This works great on my Ipad generation 2, but I just got an Ipad air and everytime I try and save the Javascript, by hitting the share button, the sharyye button is greyed out and when I hit it a second time, my javascript disappears and I end up at some other previously saved bookmark.
    Do I have something messed up in settings ?

    Doug

  2. gina says:

    It works, but it breaks up the page too much.

  3. Karthik says:

    I could see how many I phone user come here by Google and cry back go home with no solution .. I too using I phone 5 s

  4. Karthik says:

    yes people are put in jail like they can’t think or do of anything they wish to .. This push everyone to jail break the iPhone

  5. Karthik says:

    So it consumes internet bandwidth for the convertion .. Why not Apple produce a software for such a basic need for end users

  6. Eik says:

    Pretty cool, thanks.

  7. gesooli says:

    the problem is i cannot access my clipboard!!

  8. gesooli says:

    hi
    i really like your steps but i cannot figure them out on my iphone5s :( please help me

  9. Joyce says:

    Your instructions don’t make sense to me. I don’t find a “share” button on Safari, so am stymied before I get started!

    • Comprendo says:

      As the instructions say, the “Share” button in Safari looks like a square with an arrow coming out of it. Easy, just read and follow the tutorial!

  10. dadeeeee says:

    it worked! thanks

  11. Eric Sternot says:

    Does not appear to work with encrypted pages requiring a login.

    • RSG says:

      No, it wouldn’t—or with any page that had dynamic content (eg, those WWW pages which refreshed automatically, such as many news service sites).

      What this method is basically doing is sending a particular URL to a third-party service and saying “print this URL as a PDF” so that one of the services noted can do so and then send it back to your iOS device as a PDF.

      Put another way, it’s not making a PDF out of the page on your device, it’s having a remote site pull the URL on their end and then make a PDF out of it.

Leave a Reply

 

Shop on Amazon.com and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks

News

iPhone / iPad

Mac

Troubleshooting

Shop on Amazon to help support this site