PDFKIT - download PDF through browser instead of saving locally
<p>Looking for some assistance in outputting my PDF to the browser once the script is called. Currently - when the script executes it saves the file called "README.pdf" into the working directory in which the script is executed.</p>

<p>Instead of saving the file locally - how can I get this to immediately start a download via the browser?</p>

<pre><code>#!/usr/bin/env python

from markdown import markdown
import pdfkit

input_filename = 'index.html'
output_filename = 'README.pdf'

with open(input_filename, 'r') as f:
    html_text = f.read()

pdfkit.from_string(html_text, output_filename)

f = open(output_filename, 'r')
pdf = f.read()
f.close()
print "Content-Type: application/pdf\n"
print pdf
</code></pre>

<p>Ajax Request</p>

<pre><code>                Ext.Ajax.request({
                    url: 'data.php',
                    async: true,
                    params: {
                        action: 'run-actions-pdf',
                        type: 'config',
                        account_name: me.currentRecord.data.account_name,
                        state: 0
                    },
                    success: function() {}
                });
</code></pre>