forked from openlp/openlp
Fix PDF reader using wrong maindisplay size.
This commit is contained in:
parent
60d45d8b8b
commit
1b332c1580
@ -89,11 +89,11 @@ class PdfController(PresentationController):
|
|||||||
# Analyse the output to see it the program is mudraw, ghostscript or neither
|
# Analyse the output to see it the program is mudraw, ghostscript or neither
|
||||||
for line in runlog.splitlines():
|
for line in runlog.splitlines():
|
||||||
decoded_line = line.decode()
|
decoded_line = line.decode()
|
||||||
found_mudraw = re.search('usage: mudraw.*', decoded_line)
|
found_mudraw = re.search('usage: mudraw.*', decoded_line, re.IGNORECASE)
|
||||||
if found_mudraw:
|
if found_mudraw:
|
||||||
program_type = 'mudraw'
|
program_type = 'mudraw'
|
||||||
break
|
break
|
||||||
found_gs = re.search('GPL Ghostscript.*', decoded_line)
|
found_gs = re.search('GPL Ghostscript.*', decoded_line, re.IGNORECASE)
|
||||||
if found_gs:
|
if found_gs:
|
||||||
program_type = 'gs'
|
program_type = 'gs'
|
||||||
break
|
break
|
||||||
@ -222,8 +222,8 @@ class PdfDocument(PresentationDocument):
|
|||||||
continue
|
continue
|
||||||
# Calculate the ratio from pdf to screen
|
# Calculate the ratio from pdf to screen
|
||||||
if width > 0 and height > 0:
|
if width > 0 and height > 0:
|
||||||
width_ratio = size.right() / width
|
width_ratio = size.width() / width
|
||||||
height_ratio = size.bottom() / height
|
height_ratio = size.height() / height
|
||||||
# return the resolution that should be used. 72 is default.
|
# return the resolution that should be used. 72 is default.
|
||||||
if width_ratio > height_ratio:
|
if width_ratio > height_ratio:
|
||||||
return int(height_ratio * 72)
|
return int(height_ratio * 72)
|
||||||
@ -254,7 +254,7 @@ class PdfDocument(PresentationDocument):
|
|||||||
if not os.path.isdir(self.get_temp_folder()):
|
if not os.path.isdir(self.get_temp_folder()):
|
||||||
os.makedirs(self.get_temp_folder())
|
os.makedirs(self.get_temp_folder())
|
||||||
if self.controller.mudrawbin:
|
if self.controller.mudrawbin:
|
||||||
runlog = check_output([self.controller.mudrawbin, '-w', str(size.right()), '-h', str(size.bottom()),
|
runlog = check_output([self.controller.mudrawbin, '-w', str(size.width()), '-h', str(size.height()),
|
||||||
'-o', os.path.join(self.get_temp_folder(), 'mainslide%03d.png'), self.file_path],
|
'-o', os.path.join(self.get_temp_folder(), 'mainslide%03d.png'), self.file_path],
|
||||||
startupinfo=self.startupinfo)
|
startupinfo=self.startupinfo)
|
||||||
elif self.controller.gsbin:
|
elif self.controller.gsbin:
|
||||||
|
@ -135,5 +135,5 @@ class TestPdfController(TestCase, TestMixin):
|
|||||||
self.assertEqual(760, image.height(), 'The height should be 760')
|
self.assertEqual(760, image.height(), 'The height should be 760')
|
||||||
self.assertEqual(537, image.width(), 'The width should be 537')
|
self.assertEqual(537, image.width(), 'The width should be 537')
|
||||||
else:
|
else:
|
||||||
self.assertEqual(767, image.height(), 'The height should be 767')
|
self.assertEqual(768, image.height(), 'The height should be 768')
|
||||||
self.assertEqual(543, image.width(), 'The width should be 543')
|
self.assertEqual(543, image.width(), 'The width should be 543')
|
||||||
|
Loading…
Reference in New Issue
Block a user