Commit 9693a7f7 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Use _unpackData function instead of _unpackData method

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13952 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 514df2d6
......@@ -25,16 +25,19 @@
#
##############################################################################
import tempfile, os, cStringIO
from AccessControl import ClassSecurityInfo
from Products.CMFCore.WorkflowCore import WorkflowMethod
from Products.CMFCore.utils import getToolByName
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5Type.Cache import CachingMethod
from Products.ERP5.Document.Image import Image
from Products.ERP5.Document.Document import ConversionCacheMixin
from Products.CMFCore.utils import getToolByName
from zLOG import LOG
from Products.ERP5.Document.File import _unpackData
import tempfile, os, cStringIO
from zLOG import LOG
class PDFDocument(Image, ConversionCacheMixin):
"""
......@@ -75,7 +78,7 @@ class PDFDocument(Image, ConversionCacheMixin):
"""
if format is None:
RESPONSE.setHeader('Content-Type', 'application/pdf')
return self._unpackData(self.data)
return _unpackData(self.data)
if format in ('html', 'txt', 'text'):
mime, data = self.convert(format)
RESPONSE.setHeader('Content-Length', len(data))
......@@ -119,7 +122,7 @@ class PDFDocument(Image, ConversionCacheMixin):
Convert the PDF text content to text with pdftotext
"""
tmp = tempfile.NamedTemporaryFile()
tmp.write(self._unpackData(self.data))
tmp.write(_unpackData(self.data))
tmp.seek(0)
cmd = 'pdftotext -layout -enc UTF-8 -nopgbrk %s -' % tmp.name
r = os.popen(cmd)
......@@ -137,7 +140,7 @@ class PDFDocument(Image, ConversionCacheMixin):
successfully
"""
tmp = tempfile.NamedTemporaryFile()
tmp.write(self._unpackData(self.data))
tmp.write(_unpackData(self.data))
tmp.seek(0)
cmd = 'pdftohtml -enc UTF-8 -stdout -noframes -i %s' % tmp.name
r = os.popen(cmd)
......@@ -157,7 +160,7 @@ class PDFDocument(Image, ConversionCacheMixin):
successfully
"""
tmp = tempfile.NamedTemporaryFile()
tmp.write(self._unpackData(self.data))
tmp.write(_unpackData(self.data))
tmp.seek(0)
cmd = 'pdfinfo -meta -box %s' % tmp.name
r = os.popen(cmd)
......
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