Commit 800e7a09 authored by Ivan Tyagov's avatar Ivan Tyagov

When converting from any OOo based document to image (through temporary PDF)...

When converting from any OOo based document to image (through temporary PDF) explicitly require conversion for first frame only which is what we expect. Clean up duplicating code.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@37103 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cfebfa1b
...@@ -314,7 +314,7 @@ class OOoDocument(PermanentURLMixIn, BaseConvertableFileMixin, File, ...@@ -314,7 +314,7 @@ class OOoDocument(PermanentURLMixIn, BaseConvertableFileMixin, File,
if len(format_list): if len(format_list):
format = format_list[0] format = format_list[0]
else: else:
# We must fist make a PDF # We must fist make a PDF which will be used to produce an image out of it
requires_pdf_first = 1 requires_pdf_first = 1
format_list = [x for x in self.getTargetFormatList() format_list = [x for x in self.getTargetFormatList()
if x.endswith('pdf')] if x.endswith('pdf')]
...@@ -386,17 +386,14 @@ class OOoDocument(PermanentURLMixIn, BaseConvertableFileMixin, File, ...@@ -386,17 +386,14 @@ class OOoDocument(PermanentURLMixIn, BaseConvertableFileMixin, File,
file_name=self.getId(), file_name=self.getId(),
temp_object=1) temp_object=1)
temp_image._setData(data) temp_image._setData(data)
mime, data = temp_image.convert(original_format, display=display, **kw) # we care for first page only
if requires_pdf_first: mime, data = temp_image.convert(original_format, display=display, frame=0, **kw)
if display is None: # store conversion
self.setConversion(data, mime, format=original_format)
else:
self.setConversion(data, mime, format=original_format, display=display)
else:
if display is None: if display is None:
self.setConversion(data, mime, format=original_format) self.setConversion(data, mime, format=original_format)
else: else:
self.setConversion(data, mime, format=original_format, display=display) self.setConversion(data, mime, format=original_format, display=display)
if requires_pdf_first: if requires_pdf_first:
format = original_format format = original_format
if display is None or original_format not in VALID_IMAGE_FORMAT_LIST: if display is None or original_format not in VALID_IMAGE_FORMAT_LIST:
......
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