问题
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 :
- Not very DRY
- 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