Remove logger.info and use shutil.which to find pdftopng executable
parent
4628be9251
commit
c3b0fa30dc
|
|
@ -24,8 +24,6 @@ class ImageConversionBackend(object):
|
|||
|
||||
if self.use_fallback:
|
||||
for fallback in self.fallbacks:
|
||||
logger.info(f"Falling back on '{fallback}'")
|
||||
|
||||
try:
|
||||
converter = backends[fallback]()
|
||||
converter.convert(pdf_path, png_path)
|
||||
|
|
|
|||
|
|
@ -1,11 +1,18 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
|
||||
class PopplerBackend(object):
|
||||
def convert(self, pdf_path, png_path):
|
||||
pdftopng_command = ["pdftopng", pdf_path, png_path]
|
||||
pdftopng_executable = shutil.which("pdftopng")
|
||||
if pdftopng_executable is None:
|
||||
raise OSError(
|
||||
"pdftopng is not installed. Please install it using the `pip install pdftopng` command."
|
||||
)
|
||||
|
||||
pdftopng_command = [pdftopng_executable, pdf_path, png_path]
|
||||
|
||||
try:
|
||||
subprocess.check_output(
|
||||
|
|
|
|||
Loading…
Reference in New Issue