I am a sucker for
speedy workflows nice, clean PDFs customization punishment. So, I spent a bunch of hours tuning up some shortcuts to create a quick way to clip nice, clean, customizable PDFs into DEVONthink.
I use DEVONthink for a variety of purposes. Chiefly, it provides a robust repository for everything I’ve ever thought of, done, or found.1 That last use-case is the focus of this article—and the iOS shortcut I’m sharing.
On macOS, users have seemingly infinite options to save new items into DEVONthink. You can clip them straight into the app using the Clip to DEVONthink tool, you can save them in your own formats and import them into DEVONthink, you can drop them into a designated file system folder and use Folder Actions to import them automatically. macOS’ flexibility makes all of these options easy.
On DEVONthink To Go (DTTG), DEVONthink’s iOS and iPadOS (hereafter I’ll just say “iOS”) counterpart, the options are not so endless. On iOS, the Share Sheet () is used to get items from one app to another, and DEVONthink is no exception. Open the Share Sheet from any item and select DEVONthink, and you’ll be provided with a clipping interface that gives you many import options. However, that clipper doesn’t provide an option for saving items as PDFs. Additionally, this menu can be somewhat tedious if you’re using it often. To that end, if you want to use the same settings on a variety of imports, DEVONthink To Go supports URL commands (see page the relevant appendix of the DEVONthink To Go user guide.) For example, you can construct a URL command like
x-devonthink://createbookmark?destination=D3BB6ED8-41AC-4A5E-A6A0-7984DC9811B3&location=https://fulcra.design, and every time you open that command it will create a new Bookmark for the URL https://fulcra.design in the DEVONthink record with a Universally Unique Identifier (UUID) of D3BB6ED8-41AC-4A5E-A6A0-7984DC9811B3. A service like Shortcuts can then be used to customize the data you’re including in the URL scheme, making this option a quick, simple, standardized way of saving content to DEVONthink.
Fortunately, there is! Based on Federico Viticci’s detailed explorations of DEVONthink’s automation capabilities (and the shortcuts he published in that post), I created the 📥 DEVONsave shortcut.
The DEVONsave shortcut does a few things.
- It receives an input, expecting either something from the web, a PDF, or some text.
- If the input data is a PDF, it asks if you want to add a comment to the PDF’s record in DEVONthink, and then it saves the file to DEVONthink.
- If the input data is a bit of text, it asks if you want to add a comment to the text’s record in DEVONthink, and then it saves the text to DEVONthink in markdown format.
- If the data is from the web, it sends it to a helper shortcut, titled Article to HTML for DT using createdocument
Article to HTML for DT using createdocument is where the real magic happens:
- First, it checks whether the item contains article text. If it doesn’t, the original website isn’t formatted effectively for this purpose. In this case it saves the item to DEVONthink as a bookmark, so that you can deal with it more easily on DEVONthink 3 on macOS. (Before it saves it asks you for a comment.)
- Second, it looks for some article metadata. If it can find the author name and the published date, it adds those to a byline.
- Third, it grabs the article body and formats a HTML page with some pre-defined CSS.
- Fourth, it saves the HTML page to DEVONthink (after asking for a comment, of course).
- A final note: it adds the tag
.convertto the item.
Now, I like PDFs, so there’s one more step for me. The shortcut adds the
.convert tag to each item. In DEVONthink on macOS, I’ve set up a Smart Rule that picks up these
.convert-tagged items and immediately converts them to a PDF and removes the .convert tag. The rule runs after synchronization. It’s pretty simple:
Why is this step necessary? Why not just make the PDFs within the shortcut? It’s a funny thing. Currently, a bug breaks every link in PDFs created by shortcuts. The link targets move around the page and are sometimes not there at all, even though the text looks like a link.2 I’ve reported it, but for now there’s no on-device workaround.
That’s it! Feel free to edit the CSS in the Article to HTML for DT using createdocument shortcut to suit your tastes.