diff --git a/camelot/backends/image_conversion.py b/camelot/backends/image_conversion.py index f79c236..a9b6004 100644 --- a/camelot/backends/image_conversion.py +++ b/camelot/backends/image_conversion.py @@ -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) diff --git a/camelot/backends/poppler_backend.py b/camelot/backends/poppler_backend.py index 76c4667..ab12bcf 100644 --- a/camelot/backends/poppler_backend.py +++ b/camelot/backends/poppler_backend.py @@ -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(