Commit 21d292e8 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Added support for default frame conversion (image) so that it is now possible...

Added support for default frame conversion (image) so that it is now possible to view any page in a PDF file as an image through the browser. Added better support for links in PDF file. Make sure hasBaseData is implemented at File class level.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17511 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e081f87d
......@@ -73,7 +73,8 @@ class PDFDocument(Image, ConversionCacheMixin):
'subject', 'source_reference', 'source_project_title',)
security.declareProtected(Permissions.View, 'index_html')
def index_html(self, REQUEST, RESPONSE, display=None, format='', quality=75, resolution=None):
def index_html(self, REQUEST, RESPONSE, display=None, format='', quality=75,
resolution=None, frame=0):
"""
Returns data in the appropriate format (graphical)
it is always a zip because multi-page pdfs are converted into a zip
......@@ -89,7 +90,8 @@ class PDFDocument(Image, ConversionCacheMixin):
RESPONSE.setHeader('Accept-Ranges', 'bytes')
return data
return Image.index_html(self, REQUEST, RESPONSE, display=display,
format=format, quality=quality, resolution=resolution)
format=format, quality=quality,
resolution=resolution, frame=frame)
# Conversion API
security.declareProtected(Permissions.ModifyPortalContent, 'convert')
......@@ -151,17 +153,9 @@ class PDFDocument(Image, ConversionCacheMixin):
tmp.close()
r.close()
h = h.replace('<BODY bgcolor="#A0A0A0"', '<BODY ') # Quick hack to remove bg color - XXX
h = h.replace('href="%s.html' % tmp.name.split(os.sep)[-1], 'href="asEntireHTML') # Make links relative
return h
security.declareProtected(Permissions.AccessContentsInformation, 'hasBaseData')
def hasBaseData(self):
"""
This method is an override of dynamically generated method for Document
class.Because PDFDocument does not use baae_data to store raw data.
"""
return self.get_size()>0
security.declareProtected(Permissions.AccessContentsInformation, 'getContentInformation')
def getContentInformation(self):
"""
......
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