Createhtml URL schemes on DTTG

I can’t seem to get the createhtml action to work on DTTG.

I have a Shortcut that creates a nicely formatted HTML document from e.g., a given URL, then creates a PDF, then saves that PDF to DTTG with createdocument. This works fine… except that the iOS/Shortcuts Make PDF action fails to create links. (This is a bug in iOS, far as I can tell.)

So, I’d like to use createhtml on iOS, then convert those HTML files to PDFs on the desktop. For the life of me, though, I can’t get the created HTML files to look the same as the PDF counterpart I was previously generating.

Any and all ideas welcome. (My ultimate goal is clipping clean PDF files from links quickly and easily.)

Replying to myself to clarify the ask. If anyone’s gotten x-devonthink://x-callback-url/createhtml? to work on iOS, could you share a successful example?

Or x-devonthink://x-callback-url/createdocument?uti=public.html&.

I can figure it out from there.

Anyone? Anyone? @bluefrog? :crossed_fingers:

Your example is either wrong or incomplete.

As noted in DEVONthink To Go’s ? > Help > Appendix > URL Commands, that command requires a source parameter containing raw HTML.

PS: Why are you using x-callback-url ? That is a specific type of URL scheme and unneeded unless the situation actually calls for you to pass data back to a calling application.

Ah, sorry, of course. I was trying to show an example without making it too convoluted, as the actual URL commands I’m using are quite big. Here’s an example of something I have actually tried. This particular attempt results in a blank item 18 bytes in size (so not quite empty).


(I had to truncate the actual source data because it wouldn’t let me post 40,000 characters for some reason. [kidding on the “some reason” part.])

Should the source data be HTML encoded? Base 64 encoded? I think I’ve tried both, to no avail.

But! As it happens, I figured out a solution. :tada:

I’ll post what I’ve done momentarily.

So I solved my own problem by using Base64-encoded HTML and the createdocument command with uti=public.html.

I quite like the resulting Shortcut:

Note: you need to add an “Open X-Callback URL” to the end of that to use it as a standalone shortcut

When you share a website or link to that Shortcut, it first checks that the shared content contains an article. If it doesn’t, it just saves a bookmark to DEVONthink. —if it does, it creates a nicely-formatted HTML file with a good font-size for e.g., iPhone reading without zooming around the page. Then, I have a simple Smart Rule that recognizes HTML files tagged with .convert—it converts the nicely-formatted HTML to a PDF for highlighting or whatever.

I use that Shortcut in combination with this one to clip things to DTTG/DT3:

The latter Shortcut checks whether the item is a URL, “Safari”, “Article” (two Shortcuts types that I don’t quite understand), PDF, or text. If it’s the first three, it triggers the earlier-mentioned Shortcut. If it’s a PDF, it encodes it into base64 and saves it. If it’s text, it saves it as a Markdown file.

This is based on an earlier Shortcut created by Federico Viticci of MacStories a few years ago. It streamlines the clipping process for me while providing a bit more control over what the resulting files look like.

Finally, @BLUEFROG—the Shortcut uses x-callback to create that markdown-formatted item link list.