Skip to content

Optional Configuration

Steven Harman edited this page Mar 11, 2024 · 1 revision

By default, the variable RGhost::Config::GS[:path] has the content detected from your environment , but you must configure it if your gs binary is in another path. For example, in the Microsoft platform.

RGhost::Config::GS[:path] = "C:\\gs\\bin\\gswin32c.exe"

Listed below are the keys of the said hash.

h3. :path

Path to executable Ghostscript.

RGhost::Config::GS[:path] = "C:\\gs\\bin\\gswin32c.exe"

h3. :tmpdir

Temporary directory

RGhost::Config::GS[:tmpdir] = ENV['TEMP']

h3. :default_params

Allows you to add/remove options. (use with caution!)

RGhost::Config::GS[:default_params] << '-dSAFER'

h3. :stack_elements

Defines the maximum number of elements for each matrix inside postscript's internal stack, avoiding a stack overflow error.

RGhost::Config::GS[:stack_elements] = 5000

h3. :unit

Set the measure units. See Units::Unit for available units.

RGhost::Config::GS[:unit] = RGhost::Units::Cm

h3. :charset_convert

Ruby to PS character conversion proxy. Necessary when the source code isn't in the same encoding as the document. Params is a block that returns a String. The default is below, to disable set it as nil.

RGhost::Config::GS[:charset_convert] = lambda {|text| Iconv::iconv('latin1','utf8', text)}

h3. :font_encoding

Sets the Postscript font encoding. Default: :IsoLatin. This parameter can be enabled at the creation of the document.

RGhost::Config::GS[:font_encoding] = :IsoLatin

h3. :extensions

Sets the options library path. Includes fonts and postscript codes.

RGhost::Config::GS[:extensions] << /mydir”

h3. :preload

Preloads library by file name, the system will search inside :extensions directories.

RGhost::Config::GS[:preload] << :mylib