windows gs detection

Discussion in 'Ruby' started by Martin DeMello, Aug 21, 2004.

  1. Is there a nice way under windows to determine if the user has
    ghostscript installed? Do I have to rely on his having it in his path?

    martin
    Martin DeMello, Aug 21, 2004
    #1
    1. Advertising

  2. Hi Martin,

    "Martin DeMello" <> wrote in message

    > Is there a nice way under windows to determine if the user has
    > ghostscript installed?


    Searching for the registry is one way to do it ... see attached
    screen-shot of how it looks on my machine. Of course, you would
    want to determine this programmatically, right? Hint: You will have
    to require 'win32/registry.rb'

    > Do I have to rely on his having it in his path?


    Well, path will tell you that gswin32.exe is available as a command
    without requiring explicit full path-name. It does not prove the
    existence (or lack thereof) of the software.

    > martin


    HTH,
    -- shanko
    PS> I am curious to know how your postscript generation is coming
    along .. are you also generating PDFs?
    Shashank Date, Aug 21, 2004
    #2
    1. Advertising

  3. Shashank Date <> wrote:
    > Hi Martin,
    >
    > "Martin DeMello" <> wrote in message
    >
    > > Is there a nice way under windows to determine if the user has
    > > ghostscript installed?

    >
    > Searching for the registry is one way to do it ... see attached
    > screen-shot of how it looks on my machine. Of course, you would
    > want to determine this programmatically, right? Hint: You will have
    > to require 'win32/registry.rb'


    Thanks, I'll dig into that. Is it guaranteed that ghostscript will make
    a registry entry when it's installed, do you know? I'm optimistic about
    this because cutepdf
    [http://www.acrosoftware.com/Products/CutePDF/writer.asp] says it'll
    autodetect a ghostscript installation; I just didn't know how it was
    done.

    > > Do I have to rely on his having it in his path?

    >
    > Well, path will tell you that gswin32.exe is available as a command
    > without requiring explicit full path-name. It does not prove the
    > existence (or lack thereof) of the software.


    I don't get this bit. What I meant was, need a solution depend on gs
    being in the path, and test directly if I can run ps2pdf or if it
    returns an error.

    > > martin

    >
    > HTH,
    > -- shanko
    > PS> I am curious to know how your postscript generation is coming
    > along .. are you also generating PDFs?


    Coming along very nicely, and yes, it's doing pdfs too (once I figured
    out I had to call "ps2pdf.bat" rather than "p2spdf"). Right now it relies
    on the fact that both ps2pdf.bat and gswin32.exe are in my path, which
    from the point of view of a non-techie user is suboptimal; I'm looking
    into autodetecting the ghostscript install and adding it to ENV['PATH']
    before calling system().

    You can see the code and sample output at http://zem.novylen.net/ruby

    martin
    Martin DeMello, Aug 22, 2004
    #3
  4. Hi Martin,

    "Martin DeMello" <> wrote in message
    > Thanks, I'll dig into that. Is it guaranteed that ghostscript will make
    > a registry entry when it's installed, do you know?


    Assuming that the installation procedures get properly executed,
    yes, I am reasonably sure that the registry entry will be there.

    > I'm optimistic about this because cutepdf
    > [http://www.acrosoftware.com/Products/CutePDF/writer.asp]
    > says it'll autodetect a ghostscript installation; I just didn't know how

    it was
    > done.


    Don't know how they do it but thanks for the link. Will check it out.

    > > > Do I have to rely on his having it in his path?

    > >
    > > Well, path will tell you that gswin32.exe is available as a command
    > > without requiring explicit full path-name. It does not prove the
    > > existence (or lack thereof) of the software.


    I meant that the installation does not seem to add the component to
    the path so the end-user has to do it manually. And any time there is
    manual intervention, things be messed up ;-)

    So, in my case, for example I have installed GS but did not add it to
    the path. OTOH, you may add it to the path and then uninstall GS.
    Relying on the PATH environment variable will be risky.

    > I don't get this bit. What I meant was, need a solution depend on gs
    > being in the path, and test directly if I can run ps2pdf or if it
    > returns an error.


    Again, if you run ps2pdf and the test comes back with error it does
    NOT imply that the s/w is not installed.

    Hope I'm not missing the point.

    > > > martin

    > >
    > > HTH,
    > > -- shanko
    > > PS> I am curious to know how your postscript generation is coming
    > > along .. are you also generating PDFs?

    >
    > Coming along very nicely, and yes, it's doing pdfs too (once I figured
    > out I had to call "ps2pdf.bat" rather than "p2spdf"). Right now it relies

    ^^^^^^^^^
    He he, saw your tip on this a while back ;-)

    > on the fact that both ps2pdf.bat and gswin32.exe are in my path, which
    > from the point of view of a non-techie user is suboptimal; I'm looking
    > into autodetecting the ghostscript install and adding it to ENV['PATH']
    > before calling system().


    Then registry is the way to go ... but still "guaranteed" is too strong a
    word.

    > You can see the code and sample output at http://zem.novylen.net/ruby


    Cool ! Thanks will check it out.

    > martin

    -- shanko
    PS> Did not know your IITB (sorry IITM) lineage :)
    Shashank Date, Aug 22, 2004
    #4
  5. Shashank Date <> wrote:
    >
    > Again, if you run ps2pdf and the test comes back with error it does
    > NOT imply that the s/w is not installed.
    >
    > Hope I'm not missing the point.


    No, I was the one who missed the point. I wasn't sure if the registry
    thing was guaranteed, and it seemed then that the only perfectly sure
    way was (i) to require it in the path and (ii) to test that I could
    actually call it.

    > PS> Did not know your IITB (sorry IITM) lineage :)


    :) Which year?

    martin
    Martin DeMello, Aug 22, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Arnaud
    Replies:
    2
    Views:
    3,471
    Amontec Team, Laurent Gauch
    Feb 11, 2004
  2. Klejmann

    hazard detection unit

    Klejmann, Jun 18, 2004, in forum: VHDL
    Replies:
    0
    Views:
    2,209
    Klejmann
    Jun 18, 2004
  3. Raghavendra

    Edge Detection circuit.

    Raghavendra, Oct 8, 2004, in forum: VHDL
    Replies:
    17
    Views:
    32,464
    digitalpbk
    Jun 30, 2009
  4. M.Randelzhofer

    edge detection using subprograms

    M.Randelzhofer, Feb 5, 2005, in forum: VHDL
    Replies:
    6
    Views:
    4,805
    Jim Lewis
    Feb 9, 2005
  5. Beusse Beusse
    Replies:
    3
    Views:
    105
    John Allen
    Jan 23, 2011
Loading...

Share This Page