Commit 4d42458e authored by Nicolas Delaby's avatar Nicolas Delaby

revert r29404 because it is not in good place (Should be in Image or at...

revert r29404 because it is not in good place (Should be in Image or at portal_transforms level) and change DPI even if
size of image is low.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35622 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 29b9272d
......@@ -126,24 +126,9 @@ class PDFDocument(Image):
text = ''
content_information = self.getContentInformation()
page_count = int(content_information.get('Pages', 0))
try:
# if the dimension is too big, rasterized image can be too
# big. so we limit the maximum of rasterized image to 4096
# pixles.
# XXX since the dimention can be different on each page, it is
# better to call 'pdfinfo -f page_num -l page_num' to get the
# size of each page.
max_size = 4096
size = content_information.get('Page size',
'%s x %s pts' % (max_size, max_size))
width = int(size.split(' ')[0])
height = int(size.split(' ')[2])
resolution = 72.0 * max_size / max(width, height)
except (ValueError, ZeroDivisionError):
resolution = None
for page_number in range(page_count):
src_mimetype, png_data = self.convert(
'png', quality=100, resolution=resolution,
'png', quality=100, resolution=300,
frame=page_number, display='identical')
if not src_mimetype.endswith('png'):
continue
......
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