diff options
author | francis <francis> | 2008-10-17 20:43:25 +0000 |
---|---|---|
committer | francis <francis> | 2008-10-17 20:43:25 +0000 |
commit | 729161fb2bdc308c2bb8d90f0a9a44f3b19c92c7 (patch) | |
tree | 8ad6eb3b12a52c17c96d2405f401936c8389ae2d /app/models | |
parent | c80d3d4b2a13255f83d0da7794fe4abb13af6017 (diff) |
Convert PDFs to HTML also
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/incoming_message.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb index f76479f65..a6ca692c8 100644 --- a/app/models/incoming_message.rb +++ b/app/models/incoming_message.rb @@ -19,7 +19,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: incoming_message.rb,v 1.153 2008-10-17 20:32:42 francis Exp $ +# $Id: incoming_message.rb,v 1.154 2008-10-17 20:43:25 francis Exp $ # TODO # Move some of the (e.g. quoting) functions here into rblib, as they feel @@ -172,10 +172,10 @@ class FOIAttachment system("/usr/bin/wvHtml " + tempfile.path + " " + tempfile.path + ".html") html = File.read(tempfile.path + ".html") File.unlink(tempfile.path + ".html") -# elsif content_type == 'application/pdf' -# IO.popen("/usr/bin/pdftohtml " + tempfile.path + " -", "r") do |child| -# html = child.read() + "\n\n" -# end + elsif content_type == 'application/pdf' + IO.popen("/usr/bin/pdftohtml -stdout -enc UTF-8 -noframes " + tempfile.path + "", "r") do |child| + html = child.read() + "\n\n" + end else raise "No HTML conversion available for type " + content_type end @@ -187,8 +187,8 @@ class FOIAttachment def has_body_as_html? if content_type == 'application/vnd.ms-word' return true -# elsif content_type == 'application/pdf' -# return true + elsif content_type == 'application/pdf' + return true end return false end |