>  Docs Center  >  Libraries  >  Coyote  >  CGPS2PDF


  Converts a PostScript file to a PDF file. This program requires
  the `Ghostscript <http://www.ghostscript.com/download/>` program
  to be installed on the user's computer, unless you are using a
  Macintosh computer or an alterntive UNIX command to do the conversion
  for you. If you are on a Macintosh, the supplied pstopdf
  program is used instead. Use the `UNIX_Convert_Cmd` keyword to select
  an alternative UNIX command (e.g., pstopdf or epstopdf).


    Utilities, Graphics


    ps_file: in, required, type=string
        The name of the input PostScript file that is being converted to a PDF file.
        If not provided, the user will be asked to select a file.
    pdf_file: in, optional, type=string
        The name of the output PDF file. If not provided, the name is constructed from
        the input PostScript file name.


    delete_ps: in, optional, type=boolean, default=0
        If this keyword is set, the PostScript file will be deleted after conversion.
    gs_path: in, optional, type=string
        This program assumes that UNIX users can access Ghostscript with the "gs"
        command. It assumes WINDOWS users have installed Ghostscript in either
        the C:\gs or C:\Program Files\gs directories. If either of these assumptions
        is incorrect, you can specify the directory where the Ghostscript executable
        resides with this keyword. (The Windows 32-bit executable is named gswin32c.exe
        and the 64-bit executable is named gswin64c.exe.)
    pagetype: in, optional, type=string, default="LETTER"
        Set this keyword to the "type" of page. Possible values are::
            "Letter" - 8.5 by 11 inches.
            "Legal" - 8.5 by 14 inches.
            "Ledger" - 11 by 17 inches.
            "A4" - 21.0 by 29.7 centimeters.
    showcmd: in, optional, type=boolean, default=0
          Set this keyword to print the command that is spawned in the command output window.
    silent: in, optional, type=boolean, default=0
          Set this keyword to suppress output messages.
    success: out, optional, type=boolean
          Set this keyword to a named variable that on output will contain a 1 to
          indicate successful completion of the command, or to 0 otherwise.
    unix_convert_cmd: in, optional, type=string
          There are a number of commands on UNIX machines for converting PostScript files
          to PDF files. This program assumes you are using Ghostscript to do the conversion
          for you. The Ghostscript command on most UNIX machines is "gs", which is used if
          this keyword is undefined. However, if you would prefer to use another program to do
          the conversion for you, you can specify the name of the command here. For example,
          "pstopdf" or "epstopdf". In creating the actual command, this command will be
          separated by a space from the input file name. In other words, if the alternative
          conversion command was "pstopdf", the actual command would be "pstopdf" + " " + ps_file.
          Any output filename is ignored. This command does not apply to Macintosh or Windows
    version: out, optional, type=string
        On exit, contains the version of Ghostscipt that was used. Not available on Macs
        or if an alternative UNIX command was used.


    A typical sequence of commands to create a test.pdf file::
      cgPS_Open, Filename='test.ps'
      cgHistoplot, cgDemoData(7), /Fill
      cgPS2PDF, 'test.ps'


          David W. Fanning
          1645 Sheely Drive
          Fort Collins, CO 80526 USA
          Phone: 970-221-0438
          E-mail: david@idlcoyote.com
          Coyote's Guide to IDL Programming: http://www.idlcoyote.com


    Change History::
        Written, 6 December 2011, from code supplied to me by Paul Krummel. DWF.
        I had been using the Mac command pstopdf to create PDF files on Macs. Unfortunately, these
          PDF files are rotated incorrectly for plots having a landscape aspect ratio (ie, most plots).
          In this version of the software, I have decided to have Macs use Ghostscript and ImageMagick
          like all other UNIX machines. However, I have left the pstopdf code in place to accommodate
          anyone who prefers that method. You will have to uncomment the appropriate bits of code
          (there are two places where this has to happen, search for "DARWIN" in the code). 14 Aug 2013. DWF.


    Copyright (c) 2011, Fanning Software Consulting, Inc.

© 2019 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us