iPad Save As PDF

Posted: 4th October 2010 by Gavin Dudeney in General

If  like me you do a lot of web-based research, then this tip might help you – basically it allows you to save any webpage in Safari on the iPad as a PDF straight into an iPad app that will let you open it, annotate it and save the finished document as well as transfer it to your computer (with mark-up intact) or share it on DropBox, etc. For this little trick you will need the following:

  1. A copy of Good Reader [ 99 cents isn't going to break the bank ]
  2. A special bookmark added to Safari on the iPad

Once you have GoodReader installed on the iPad, go to Safari and open any website and add it to your bookmarks. Next, go to your bookmarks, click ‘Edit‘, find the bookmark and change the title to something like ‘Save to GoodReader PDF” and the link to the following:

javascript:pdf_url=location.href;location.href=’ghttp://pdfmyurl.com?url=’+escape(pdf_url)

[ that should all be on one line with no spaces...]

This handy little mini script asks the service http://pdfmyurl.com to turn the currently viewed page into a PDF. The big trick is adding ‘g‘ to the address (ghttp://) which actually tells GoodReader to download the resultant document.

Result? Each time you want to save a page as a PDF in GoodReader, all you need to do is load it up in Safari and use the bookmark you created. Note that if the page you’re trying to save is already a PDF, all you need to do is reload the page itself with a ‘g‘ in front of the ‘http://‘ part of the address.

If you need more powerful mark-up tools, try iAnnotate PDF.

UPDATE: May 3rd 2011
This bookmark in Safari on the iPad (one line, no spaces) will also download a webpage as a PDF and save it to Goodreader:

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


  1. [...] This post was mentioned on Twitter by Gavin Dudeney, Miguel Mendoza. Miguel Mendoza said: RT @dudeneyge: Save any webpage in Safari on the iPad as a PDF for offline viewing and annotating – new blog post : http://bit.ly/czLUhL [...]

  2. Michael says:

    I love this tip – thank you! – but one question: after downloading Good Reader, the App told me that I downloaded the wrong version – I should be using “Good Reader for iPad”. Cool, so I downloaded it, but the hint doesn’t seem to work in the iPad version (on my iPad!), it only seems to work with my iPhone version on the iPad. Did you run into this? Maybe if I just uninstall then re-install? Anyway, thanks for sharing, and peace! :)

    [Reply]

  3. Michael,

    Welcome – and thanks for the comment. I’m not sure why it doesn’t work on the iPad.
    GoodReader itself is responsible for handling the ‘ghttp://’ part of the configuration – have you tried just adding a ‘g’ in front of a web address in Safari on the iPad? If it opens then GoodReader is configured properly to work with Safari. Next, check you’ve copied the bookmark text properly.

    If all else fails, I’d re-install GoodReader.

    Good luck!

    Gavin

    [Reply]

  4. Michael says:

    Thanks for your response! So I tried again last night, and I think this is what I ran into: I had both the “iPhone” and “iPad” versions of GoodReader installed, the “ghttp” command started out trying to send it to the iPhone version. I deleted the iPhone version of GoodReader and restarted my iPad…. then all went well and the ghttp requests went to the new iPad version of GoodReader :) . Before I restarted I was receiving an error (invalid request, from Safari), after all was well.

    Anyway, thanks again for the tip, I love this feature!!! :) Thanks and peace!

    [Reply]

  5. Bryson Perry says:

    I downloaded Version 3.0.2 of GoodReader for the iPad and within the APP, push the settings icon -> General Settings -> Click on Green “Put special address to clipboard” and this will put in the clipboard the address you need in the bookmarks bar.

    In addition, I had GoodReader lite also and had to delete the app and “restart” to get the link to work. Now everything works great.

    [Reply]

  6. Sean A says:

    Hi

    Thanks for the tip. However I have a couple of comments (and questions)

    I tried to add “g” to some url including this present page’s url, and it resulted indeed in copying the url to GoodReader files. However the file was still in html format, not in pdf, and when opened within GoodReader, it was opened with GR internal basic browser.

    I tried to use the special bookmark that I saved as described, but I guess I did not quite understand how to use it…. Am I supposed to open a webpage with Safari and then click on the bookmark ? So did I, but this did not seem to do anything…
    So the question is: how do we actually use the special link in order to convert a web page into pdf doc ?
    Thanks for all

    Regards,

    Sean A

    [Reply]

    Gavin Dudeney Reply:

    Sean,

    Yes, the idea is that you add the bookmark to Safari first (having installed Goodreader. Once this is done, you visit a website and click the bookmark – this opens Goodreader and downloads the article as a PDF. However, it does use an intermediary website to do that, so if that website is down, it won’t work. I just tried it again and it worked fine for me, but your mileage may vary :-)

    Gavin

    [Reply]

    Sean A Reply:

    Thanks so much Gavin for taking the time to rely.
    I am unfortunately still having difficulties making this work. I looked a little oclosed to what happens when I click on the bookmark and it actually generate an error message: Javascript error in line 1:Undefined SyntaxError: parse error
    Naturally I ckecked carefully seval times the javascript line/bookmark link and it is correct, identical to the one provided here… Also, I checked on my iPad settings that javascript was indeed enabled in Safari…
    Any idea on what may be the problem?
    Cheers,

    Sean A.

    [Reply]

  7. Joi Jetson says:

    Im having trouble too. Safari is converting the ‘ (single quotation) into %E2%80%99

    Although I copied:
    javascript:pdf_url=location.href;location.href=’ghttp://pdfmyurl.com?url=’+escape(pdf_url)

    Safari has converted that to read

    javascript:pdf_url=location.href;location.href=%E2%80%99ghttp://pdfmyurl.com?url=%E2%80%99+escape(pdf_url)

    The second link gives me the same results *sighs*
    Is anyone getting this response from Safari?

    [Reply]

  8. Tony Foley says:

    Sean,

    Thanks for that great tip, I can see plenty of use for this function. As the above comment said the ipad converts the javascript – however with editing it works perfectly.

    Cheers.

    [Reply]

  9. Behar says:

    I had the same Problem… Just go and edit the Bookmark and change %E2%80%99 to single quotes manually because it converts the chars into html-entities when copy and pasting… Or just type in the whole code manually.

    [Reply]

  10. Bob says:

    While this tip is nice it sadly will not work on any site that is secured (requiring a user and / password) as the goodreader is a separate session with the website. It also does not deal with the fact that Goodreader, while a good program is some ways, fails at the one thing it really needs to do and that is retain the file name correctly as it was provided from the website it was downloaded from.

    It seems that Good reader does not know (or does not care, not sure) about the file name as is, a result takes a PDF that is named something like “This is my File.pdf” and names it something like “QL1489zd53854ghr.pdf” which unfortunately is a name that is useless to anyone. Yes, I can take the extra steps needed to rename it myself but it should not be needed as the website already provided the correct name.

    I believe that if they could fix that then they will truly have a great program, till then it is just a good / so-so program

    [Reply]

  11. Pete Zerger says:

    Likewise, I was unable to make this work, but the ‘special bookmark’ option provided in Goodreader is an instant fix. The URL provided by Goodreader is

    javascript:window.location=’g'+location.href

    [Reply]

  12. Wildman says:

    Thanks for this info. It was a great launching point for helping me do what I wanted — save a webpage as a pdf in iOS. With a small tweak to your awesome javascript, I’m able to get the newly created pdf to open in iOS Safari, then use the “open in…” menu to route it to dropbox, goodreader, evernote, etc.

    Two things I did to make the javascript work for me: 1) Remove the letter “g” from the javascript so the resulting pdf goes back to Safari.

    2) After saving the javascript as a bookmark the first time, reopen the bookmark and make sure it looks exactly like it does below. As Behar mentions above, iOS will likely change the single quotes into a “%E2%80%99″ after the first save.

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

    I’m using this workflow to save pages to evernote. Thanks again!

    [Reply]

  13. roberto says:

    hi guys cant make it work with an ipad 3 anyone having problems?

    [Reply]