Editorial Workflows

Fountain to PDF

public workflow

Install Workflow...

This workflow contains at least one Python script. Only use it if you trust the person who shared this with you, and if you know exactly what it does.

I understand, install the workflow!

This is a workflow for Editorial, a Markdown and plain text editor for iOS. To download it, you need to view this page on a device that has the app installed.

Description: Converts a Fountain screenplay to PDF, using the `screenplain` Python module. The result is shown in a browser tab.

Shared by: my nameMRI

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
If… ?
Run the block if
File Extension
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
fountain
Show Alert ?
Title
Not Fountain?
Message
This document has a ".File Extension" file extension, but Fountain documents typically use ".fountain". Would you like to continue?
Button 1
Continue
Output Value
Input
Button 2
(don't show)
Output Value
Button 3
(don't show)
Output Value
Show Cancel Button
ON
…End If
Document Text ?
Folded Text
  • Include
  • Replace with:
Run Python Script ?
Source Code
#coding: utf-8
import workflow
from screenplain.export.pdf import to_pdf
from screenplain.parsers import fountain
import os
from StringIO import StringIO
import urlparse
import urllib

action_in = workflow.get_input()
sio = StringIO(action_in)
screenplay = fountain.parse(sio)
name = 'Output.pdf'
to_pdf(screenplay, name)
url = urlparse.urljoin('file:', urllib.pathname2url(os.path.abspath(name)))
workflow.set_output(url)
Show Result ?
Open in
  • In-App Browser
  • Default App / Safari
URL
Input
Tab
  • Last-used Tab
  • New Tab
  • Tab with ID:
FountainPDF
Wait until Loaded
OFF
Reveal Browser Automatically
ON