Skip to content

Commit

Permalink
Add pdftopng
Browse files Browse the repository at this point in the history
  • Loading branch information
vinayak-mehta committed Oct 16, 2020
1 parent 4edca28 commit 3ff5b30
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
11 changes: 2 additions & 9 deletions camelot/parsers/lattice.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,17 +208,10 @@ def _copy_spanning_text(t, copy_text=None):
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 {} -r300 {}".format(
self.imagename, 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):
Expand Down
9 changes: 5 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
'PyPDF2>=1.26.0'
]

cv_requires = [
'opencv-python>=3.4.2.17'
base_requires = [
'opencv-python>=3.4.2.17',
'pdftopng>=0.1.0'
]

plot_requires = [
Expand All @@ -40,7 +41,7 @@
'Sphinx>=3.1.2'
]

all_requires = cv_requires + plot_requires
all_requires = base_requires + plot_requires
dev_requires = dev_requires + all_requires


Expand All @@ -58,7 +59,7 @@ def setup_package():
install_requires=requires,
extras_require={
'all': all_requires,
'cv': cv_requires,
'base': base_requires,
'dev': dev_requires,
'plot': plot_requires
},
Expand Down

0 comments on commit 3ff5b30

Please sign in to comment.