Action

PDF Export

Posted by raigmcclellan, Last update over 5 years ago

I often like to edit my writing using GoodNotes and my Apple Pencil. In order to do this, I need to be able to export a Draft as a PDF. I couldn’t come up with a way to do this natively in Workflow, so I combined a script with this Workflow. You may want to change the fonts or styles. I like large line spacing with room to write.

Steps

  • script

    // Process Markdown to HTML
    var mmd = MultiMarkdown.create();
    var html = mmd.render(draft.content);
    
    // Wrap raw MMD output with HTML template with styles to set base fonts.
    var template = "<html><style>body{font-family:'Avenir Next';font-size:100%;line-height: 3;}</style><body>[[content]]</body></html>"
    var html = template.replace("[[content]]", html);
    
    // Set draft template which can be used by the run workflow action next
    draft.setTemplateTag("script_content", html)
  • runWorkflow

    workflowName
    Blog Post Editor
    waitForResponse
    false

Options

  • After Success Default
    Notification Info
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.