pdftk

ThomasHeetderks thomas at earthtalk.com
Wed Apr 15 18:32:37 EDT 2009



Bugzilla from r.bauer at fz-juelich.de wrote:
> 
> 
> Does one know about a python interface to pdftk?
> Or something similar which can be used to fill a form by fdf data.
> 

...Or if you want to return the PDF as a Django response:

from subprocess import Popen, PIPE

cmd = 'pdftk.exe %s fill_form - output - flatten' % PDF_SOURCE
proc = Popen(cmd,stdin=PIPE,stdout=PIPE,stderr=PIPE)
cmdout,cmderr = proc.communicate(fdf)
if cmderr: raise Hppt404
response = HttpResponse(mimetype='application/pdf')
response['Content-Disposition'] = 'inline; filename=filename.pdf'
response.write(cmdout)
return response

Hope this is useful.

- Thomas
-- 
View this message in context: http://www.nabble.com/pdftk-tp22188221p23068300.html
Sent from the Python - python-list mailing list archive at Nabble.com.




More information about the Python-list mailing list