[Erp5-report] r17511 - /erp5/trunk/products/ERP5/Document/PDFDocument.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Sat Nov 10 13:22:18 CET 2007
Author: jp
Date: Sat Nov 10 13:22:18 2007
New Revision: 17511
URL: http://svn.erp5.org?rev=17511&view=rev
Log:
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.
Modified:
erp5/trunk/products/ERP5/Document/PDFDocument.py
Modified: erp5/trunk/products/ERP5/Document/PDFDocument.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/PDFDocument.py?rev=17511&r1=17510&r2=17511&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/PDFDocument.py (original)
+++ erp5/trunk/products/ERP5/Document/PDFDocument.py Sat Nov 10 13:22:18 2007
@@ -73,7 +73,8 @@
'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 @@
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,16 +153,8 @@
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):
More information about the Erp5-report
mailing list