How to use the ghostscript.execute function in ghostscript

To help you get started, we’ve selected a few ghostscript examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github brandonedens / cups-fab / cups_fab / laser_cutter.py View on Github external
else:
            log.crit("Input file is neither pdf nor postscript.")
            sys.exit(1)

        # Convert postscript to eps.
        log.info('Converting input postscript to EPS.')
        eps = ps_to_eps(job.file, self.width, self.height)

        if self.debug:
            # Debug enabled so writing the generated eps file.
            out_file = "%s.eps" % self.debug_basename(job)
            self.debug_write(out_filename, eps)

        # run ghostscript on eps
        log.info('Running ghostscript on eps file.')
        (raster, vector) = ghostscript.execute(
            eps, self.resolution,
            self.width, self.height,
            ghostscript.raster_mode_to_ghostscript(self.raster_mode))

        # convert image data to pcl
        log.info('Converting image data to PCL.')
        pcl = self.raster_to_pcl(raster)

        # convert vector data to hpgl
        log.info('Converting ghostscript vector data to HPGL')
        hpgl = self.vector_to_hpgl(vector)

        # send to printer
        log.info('Sending data to printer.')
        self.send(self.hpgl_pcl_to_pjl(job, hpgl, pcl))

ghostscript

Interface to the Ghostscript C-API, both high- and low-level, based on ctypes

GPL-3.0
Latest version published 3 years ago

Package Health Score

40 / 100
Full package analysis