Basic usage - shairontoledo/rghost GitHub Wiki
All objects inherit the PsObject class, so they all share the main methods set, raw, call and ps. To create a PSObject you pass a string (or block). Example:
Calling an object, function or variable directly from the postscript stack
Writing directly to the stack
Creating a PSObject in a block.
The main class is Document. The Document class is a PsFacade; most methods are defined in this class. Normally in examples you will see the doc.method options … . You can work with RGhost in two ways.
(recommended)
or
Using postscript commands
ps=RGhost::PsObject.new(' 1 5 2 mul add')
Calling an object, function or variable directly from the postscript stack
ps=RGhost::PsObject.new
ps.call :showpage
Writing directly to the stack
ps=RGhost::PsObject.new
ps.raw '(string text) show'
Creating a PSObject in a block.
ps=RGhost::PsObject.new do |p|
p.raw '1 5'
p.raw '2'
p.raw 'mul'
p.raw 'add'
end
The main class is Document. The Document class is a PsFacade; most methods are defined in this class. Normally in examples you will see the doc.method options … . You can work with RGhost in two ways.
(recommended)
require 'rubygems'
require 'rghost'
include RGhost
doc=Document.new
or
require 'rubygems'
require 'rghost'
doc=RGhost::Document.new