PDF from Safari Reader View

I have found the Make PDF shortcut unreliable for PDF’ing webpages. The formatting of the resulting PDF can be horrendous and not suitable for archiving or annotation. My current workflow is from Safari -> Share sheet -> using options select “Reader PDF” -> Save to Files -> Specify filename and location. This is nearly 100% reliable at producing a high quality output, comparable to entering reader view and then printing to PDF. I’d like to develop a shortcut to automate this. The options I have found for “get contents from webpage” or “Get article” don’t produce reliable PDFs. I haven’t found any tool, or shortcut, that can reliably create a usable PDF from webpage content (news/blog sites like macstories.net, etc). Macstories even published a shortcut called “Safari Reader Article to Mail” but it doesn’t match the same output as if you actually enter reader view and then either print to PDF or save to Files from that reader view. I would love any suggestions to chase this down…or other approaches folks have to get nice clean, useable PDFs from webpages for annotation and archiving. Thanks.

1 Like

In my experience, all PDFs produced by Shortcuts are broken—links after the first page have erroneous tap targets, meaning you essentially can’t click links.

So, I use a complicated workaround with DEVONthink to get PDFs with Shortcuts. It uses custom CSS to style the output so that I can make it look exactly as I want.

All written up here (including a demo showing the reproducibly broken links):

I use readability js which usually does a good job on sites. .

I usually save them as Markdeep documents which I like as it has the text saved in the html document as Markdown, and rendered by Markdeep when opened in a Browser to display as formatted.
https://www.icloud.com/shortcuts/ee2ebf29dce84cfdaec207278d6b9f52

Heres a pdf version, you can change the formatting for the pdf by changing the css
https://www.icloud.com/shortcuts/20a37e0c604b429cad0930bef9816a06

1 Like

This looks neat, thanks for sharing. Sadly it still breaks PDF links.

Thanks to both of you - I’ve had a play with each of these and they do a great job of extracting the text from webpage and I might have a separate use for that. but for this task, I’m really trying to capture the reader view with the images inline as reader view on safari will do. I’ve tried a dozen approaches with little success so I have reverted back to just (1) entering reader view, (2) share -> print (3) move resulting PDF to PDF Expert for annotation. I’d love to find a way to remove 1 or 2 steps in the process because I do it so much, but I don’t think Safari exposes the actual reader view and I haven’t found a js/css that gets close. But these shortcuts have given me a ton of ideas on how to do a few other things I’ve been wanting to try, so truly appreciate you sharing them.

2 Likes

This shortcut is useful and I am using it, but It seems to generate a not useful filename. How would I get the page <title> text to use as the save file name? My initial idea is to do some text matching before the JavaScript block, but I suspect there is a better way as the title should already be part of the metadata.

I’ve finally found an (almost) 1-click solution for this.

From Reader mode in Safari, click share → print. Then click the share button to share the PDF to a shortcut that does this:

  • Use the PDF as input
  • Use the ‘Get contents from screen’ action in Shortcuts to get the url and the the ‘Safari Reader article’ action to get stuff like the title, author, excerpt, main image
  • Create a note with all the content gathered through the article action + the pdf from the input

Now you have a neatly formatted note with a neatly formatted PDF attached.

It should also work when sharing the page as a reader pdf without going through print, but somehow in Notes this results in the text rather than the pdf being added and I can’t seem to force it to add it as a pdf

Link

1 Like

It’s a pretty far stretch from the original thread, but I’m coming very close to a perfect read-it-later set-up that involves automatically archiving a PDF of the article (which is what I intended to use it for when I replied earlier). Here’s what I do:

  • I save articles to Wallabag
  • I load them on my e-reader through KOreader
  • When I like an article, I open it on the Wallabag website on my iPad or Mac and share it with a shortcut, which then loads the metadata, highlights and a formatted PDF into my Obsidian vault

I posted about it here Save read-later articles with metadata and PDF through Wallabag - Share & showcase - Obsidian Forum

In case anyone’s interested :slight_smile: