Commit 856112c2 authored by Jean-Paul Smets's avatar Jean-Paul Smets

fixed format choice error in txt conversion which ended up returning empty string

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13838 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8b3a00ca
...@@ -100,7 +100,7 @@ class PDFDocument(Image, ConversionCacheMixin): ...@@ -100,7 +100,7 @@ class PDFDocument(Image, ConversionCacheMixin):
if not self.hasConversion(format='txt'): if not self.hasConversion(format='txt'):
data = self._convertToText() data = self._convertToText()
self.setConversion(data, mime='text/plain', format='txt') self.setConversion(data, mime='text/plain', format='txt')
return self.getConversion(format=format) return self.getConversion(format='txt')
else: else:
return Image.convert(self, format, **kw) return Image.convert(self, format, **kw)
...@@ -132,6 +132,9 @@ class PDFDocument(Image, ConversionCacheMixin): ...@@ -132,6 +132,9 @@ class PDFDocument(Image, ConversionCacheMixin):
def _convertToHTML(self): def _convertToHTML(self):
""" """
Convert the PDF text content to HTML with pdftohtml Convert the PDF text content to HTML with pdftohtml
NOTE: XXX check that command exists and was executed
successfully
""" """
tmp = tempfile.NamedTemporaryFile() tmp = tempfile.NamedTemporaryFile()
tmp.write(self._unpackData(self.data)) tmp.write(self._unpackData(self.data))
...@@ -149,6 +152,9 @@ class PDFDocument(Image, ConversionCacheMixin): ...@@ -149,6 +152,9 @@ class PDFDocument(Image, ConversionCacheMixin):
""" """
Returns the information about the PDF document with Returns the information about the PDF document with
pdfinfo. pdfinfo.
NOTE: XXX check that command exists and was executed
successfully
""" """
tmp = tempfile.NamedTemporaryFile() tmp = tempfile.NamedTemporaryFile()
tmp.write(self._unpackData(self.data)) tmp.write(self._unpackData(self.data))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment