Add pdftopng

This commit is contained in:
Vinayak Mehta
2020-10-16 16:11:10 +05:30
parent 715e8a9769
commit 57a26fabcb
2 changed files with 37 additions and 44 deletions
+2 -9
View File
@@ -208,17 +208,10 @@ class Lattice(BaseParser):
return t
def _generate_image(self):
from ..ext.ghostscript import Ghostscript
from pdftopng import pdftopng
self.imagename = "".join([self.rootname, ".png"])
gs_call = "-q -sDEVICE=png16m -o {} -r{} {}".format(
self.imagename, self.resolution, self.filename
)
gs_call = gs_call.encode().split()
null = open(os.devnull, "wb")
with Ghostscript(*gs_call, stdout=null) as gs:
pass
null.close()
pdftopng.convert(pdf_path=self.filename, png_path=self.rootname)
def _generate_table_bbox(self):
def scale_areas(areas):