Skip to content
This repository has been archived by the owner on Jan 6, 2025. It is now read-only.

Replacing Ghostscript with PDFBox #346

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,12 @@ Camelot uses [Semantic Versioning](https://semver.org/). For the available versi
## License

This project is licensed under the MIT License, see the [LICENSE](https://github.com/socialcopsdev/camelot/blob/master/LICENSE) file for details.



<p align="center">

<img src="https://i.ibb.co/mzwHHVD/Atlan-images-1.png" />

</p>

13 changes: 3 additions & 10 deletions camelot/parsers/lattice.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import logging
import warnings
import subprocess
import pdfbox

import numpy as np
import pandas as pd
Expand Down Expand Up @@ -183,16 +184,8 @@ def _copy_spanning_text(t, copy_text=None):
return t

def _generate_image(self):
from ..ext.ghostscript import Ghostscript

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()
result = pdfbox.PDFBox().pdf_to_images(self.filename, outputPrefix=self.rootname)
self.imagename = str(self.rootname)+'1.jpg'

def _generate_table_bbox(self):
def scale_areas(areas):
Expand Down