Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# 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))
# Successfully completed printing job.
log.info("Job %s printed." % job)