Call pdftopng in subprocess
This commit is contained in:
@@ -35,7 +35,7 @@ class GhostscriptBackend(object):
|
||||
"here: https://camelot-py.readthedocs.io/en/master/user/install-deps.html"
|
||||
)
|
||||
|
||||
gs_args = [
|
||||
gs_command = [
|
||||
"gs",
|
||||
"-q",
|
||||
"-sDEVICE=png16m",
|
||||
@@ -44,4 +44,4 @@ class GhostscriptBackend(object):
|
||||
f"-r{resolution}",
|
||||
pdf_path,
|
||||
]
|
||||
ghostscript.Ghostscript(*gs_args)
|
||||
ghostscript.Ghostscript(*gs_command)
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from pdftopng import pdftopng
|
||||
import subprocess
|
||||
|
||||
|
||||
class PopplerBackend(object):
|
||||
def convert(self, pdf_path, png_path):
|
||||
pdftopng.convert(pdf_path, png_path)
|
||||
pdftopng_command = ["pdftopng", 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)
|
||||
|
||||
Reference in New Issue
Block a user