Merge 96b9f04e38 into 644bbe7c6d
commit
5ca060d4cd
|
|
@ -6,17 +6,5 @@ import subprocess
|
||||||
|
|
||||||
class PopplerBackend(object):
|
class PopplerBackend(object):
|
||||||
def convert(self, pdf_path, png_path):
|
def convert(self, pdf_path, png_path):
|
||||||
pdftopng_executable = shutil.which("pdftopng")
|
from pdftopng.pdftopng import convert
|
||||||
if pdftopng_executable is None:
|
convert(pdf_path, png_path)
|
||||||
raise OSError(
|
|
||||||
"pdftopng is not installed. You can install it using the 'pip install pdftopng' command."
|
|
||||||
)
|
|
||||||
|
|
||||||
pdftopng_command = [pdftopng_executable, pdf_path, png_path]
|
|
||||||
|
|
||||||
try:
|
|
||||||
subprocess.check_output(
|
|
||||||
" ".join(pdftopng_command), stderr=subprocess.STDOUT, shell=True
|
|
||||||
)
|
|
||||||
except subprocess.CalledProcessError as e:
|
|
||||||
raise ValueError(e.output)
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue