
    Axis--PSDocument.php
    A PHP Object for Generating PostScript and PDF Documents
 
    Copyright 1999-2001 Axis Data
    This code is free software that can be used or redistributed under the
    terms of Version 2 of the GNU General Public License, as published by the
    Free Software Foundation (http://www.fsf.org).
 
    Author:  Edward Almasy (almasy@axisdata.com)
 
    Part of the AxisPHP library
    For more information see http://www.axisdata.com/AxisPHP/


    ----- CONTEXT

    PSDocument is intended to allow the generation of PostScript and PDF
    documents from within a PHP program.  For almost all practical purposes
    PDF documents can be treated like PostScript documents during creation.


    ----- SYNOPSIS
 
    require_once("Axis--PSDocument.php");

    PSDocument()
        object constructor

    NextPage()
        move to next page within document

    NextLine()
        move to next line on page based on current position and font size

    MoveToX($NewXPos)
    MoveToY($NewYPos)
    MoveTo($NewXPos, $NewYPos)
        move cursor position to absolute value X,Y

    MoveToRelX($NewXPos)
    MoveToRelY($NewYPos)
        move cursor position to X or Y relative to current position

    CurrentXPos()
    CurrentYPos()
        return current cursor position

    WritePostscriptToFile($FileName)
        write document to file as PostScript

    WritePDFToFile($OutputFileName)
        write document to file as PDF

    SetPrintCommand($NewPrintCommand)
        set print command to be used by PrintDocument()

    PrintDocument($FileNamePrefix = "PSDocument")
        print document using current print command

    SetPageSize($PointsHigh, $PointsWide)
        set page size in points

    SetTextWrapLength($NewLength = 0)
        set number of characters at which to trigger text wrapping

    SetFont($FontName, $FontSize)
        set PostScript font to use

    GetFontHeight()
        get current font height

    PageNumber($NewPageNumber = -1)
        set or get current page number

    PrintText($TextToPrint)
        add text to document at current cursor position

    PrintTextAt($XPos, $YPos, $TextToPrint)
        add text to document at specified cursor position (and move cursor)

    TextAngle($NewAngle = -1)
        set angle of text on page (0 or 90)

    UseLandscapeOrientation()
        tell document to display in landscape (horizontal wider than vertical)

    DefineStyle($StyleName, $FontName, $FontSize)
        define mnemonic string for font style

    UseStyle($StyleName)
        switch to font style specified by mnemonic string

    PrintRaw($TextToPrint)
        add raw PostScript to document stream (use with caution)


    ----- DETAIL


    ----- USAGE

    require_once("Axis--PSDocument.php");

    $Doc = new PSDocument();

    $Doc->SetFont("Times-Roman", 20);
    $Doc->PrintTextAt(200, 300, "Hello World!");

    $Doc->WritePostscriptToFile("/tmp/New_Postscript_File.ps");
    $Doc->WritePDFToFile("/tmp/New_PDF_File.pdf");


    ----- NOTES

    - The coordinate system for PostScript documents puts 0,0 in the lower
        left-hand corner of the document, with X increasing toward the right
        and Y increasing toward the top of the page.

    - The file names given to the PostScript and PDF write functions must
        specify directories where the web server has write privileges (/tmp
        is a good choice).

