com.etymon.pj.tools
Class PjScript

java.lang.Object
  extended by com.etymon.pj.tools.PjScript

public class PjScript
extends java.lang.Object

Implements a PDF scripting language. Possible result codes are 0 (scripts executed normally), 1 (error reading script), 2 (syntax error in script), and 3 (error executing script command).


Constructor Summary
PjScript()
           
 
Method Summary
private static int appendPage(Pdf pdf, java.util.Vector texts, java.util.Hashtable vars)
           
private static void drawText(Pdf pdf, java.lang.String source, int lineNumber, java.util.Hashtable fonts, java.util.Vector texts)
           
private static java.lang.String getEndLine(java.lang.String line)
           
private static PjRectangle getMediaBoxArray(java.lang.String mediaBox)
           
static void main(java.lang.String[] args)
           
private static boolean quoted(java.lang.String s)
           
static Pdf script(java.lang.String source, java.io.BufferedReader br, java.lang.String[] args)
          Creates or modifies PDF files based on a script.
private static float setMediaBox(Pdf pdf, int pageNumber, java.lang.String mediaBox, java.lang.String source, int lineNumber)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PjScript

public PjScript()
Method Detail

main

public static void main(java.lang.String[] args)

script

public static Pdf script(java.lang.String source,
                         java.io.BufferedReader br,
                         java.lang.String[] args)
                  throws PjScriptException
Creates or modifies PDF files based on a script.

Parameters:
source - the file or program name where the script originates. This is used in printing error messages.
br - the input stream containing the script.
args - the arguments to the script.
Returns:
the resultant PDF document.
Throws:
PjScriptException - if an error occurs.

drawText

private static void drawText(Pdf pdf,
                             java.lang.String source,
                             int lineNumber,
                             java.util.Hashtable fonts,
                             java.util.Vector texts)
                      throws PjScriptException
Throws:
PjScriptException

getEndLine

private static java.lang.String getEndLine(java.lang.String line)

quoted

private static boolean quoted(java.lang.String s)

appendPage

private static int appendPage(Pdf pdf,
                              java.util.Vector texts,
                              java.util.Hashtable vars)
                       throws PjException
Throws:
PjException

setMediaBox

private static float setMediaBox(Pdf pdf,
                                 int pageNumber,
                                 java.lang.String mediaBox,
                                 java.lang.String source,
                                 int lineNumber)
                          throws PjScriptException
Throws:
PjScriptException

getMediaBoxArray

private static PjRectangle getMediaBoxArray(java.lang.String mediaBox)