So transparent that i can't catch it…Using Rghost to emulate ghostscript command as would be on virtual printer

假装没事ソ 提交于 2019-12-20 03:50:28

问题


as a ruby newb i've been on a little ghost hunt that you might be of some help

I read a lot and was told the best way to get these sneaky fellows was using a script : ghostscript.

I'm trying to execute the ghostscript command that i run in a virtual printer, but in the context of a ruby (shoes) file :

My command is :

C:\Programas\gs\gs9.05\bin\gswin64c.exe -IC:\Programas\gs\gs9.05\lib;C:\Programas\gs\fonts -sDEVICE=pdfwrite -r300 -dNOPAUSE -dSAFER -sPAPERSIZE=a4 -sOutputFile=c:\tempRep\temp.pdf -

If i just put this command inside a batch file, and set this batch as the program to call within to port redirect on the virtual printer, it goes just fine, writing the temp.pdf file. The problem with this solution are actually two :

  1. Not very DRY
  2. the exe file doesn't get executed

my filecreate.bat

C:\Programas\gs\gs9.05\bin\gswin64c.exe -IC:\Programas\gs\gs9.05\lib;C:\Programas\gs\fonts -sDEVICE=pdfwrite -r300 -dNOPAUSE -dSAFER -sPAPERSIZE=a4 -sOutputFile=c:\tempRep\temp.pdf -


c:\tempRep\myapp.exe

So, if it's not DRY and bats don't seem to be helping, there is no point looking for ghosts here. We all know that to catch a ghost, it must be DRY !

So I headed towards Rghost : Reveal ghosts is the true meaning.

The context where I call it:

My shoes app source:

Shoes.setup do
   gem 'rghost'
end

require 'RGhost'

RGhost::Config::GS[:path]= 'C:\\Programas\\gs\\gs9.05\\bin\\gswin64c.exe'

doc=Document.new

doc.render :raw => "-sDEVICE=pdfwrite -r300 -dNOPAUSE -dSAFER -sPAPERSIZE=a4 -sOutputFile=c:\tempRep\temp.pdf -"

I'm starting to feel chilly, but no ghost file is showing up...

Any ideas on how to catch this one?

I am also considering using something like

system("C:\Programas\gs\gs9.05\bin\gswin64c.exe -IC:\Programas\gs\gs9.05\lib;C:\Programas\gs\fonts -sDEVICE=pdfwrite -r300 -dNOPAUSE -dSAFER -sPAPERSIZE=a4 -sOutputFile=c:\tempRep\temp.pdf -")

but it just doesn't seem to work :S...What might i be doing wrong?

来源:https://stackoverflow.com/questions/11405655/so-transparent-that-i-cant-catch-it-using-rghost-to-emulate-ghostscript-comma

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!