def _convert(self, command_path, input_path, settings=[],
prefix='', fileformat='png'):
if prefix:
prefix = '{}-'.format(prefix)
output_path = path.join(
self.dest_pages,
'{}%04d.{}'.format(prefix, fileformat)
)
exit_code = subprocess.Popen(
(command_path, *settings, input_path, output_path),
stdout=subprocess.PIPE, stderr=subprocess.DEVNULL
).wait()
if exit_code != 0:
raise ProcessingError(
'Was unable to convert document to {}s ({}).'.format(fileformat,
exit_code)
)
return glob.glob(path.join(
self.dest_pages, '{}[0-9][0-9][0-9][0-9].{}'.format(prefix,
fileformat)
))
评论列表
文章目录