PHP PostScript document creation Functions

EditRocket provides the following information on PostScript document creation functions in the PHP source code builder.

int ps_add_bookmark ( resource $psdoc , string $text [, int $parent [, int $open ]] ) - Adds a bookmark for the current page. Bookmarks usually appear in PDF-Viewers left of the page in a hierarchical tree. Clicking on a bookmark will jump to the given page.

bool ps_add_launchlink ( resource $psdoc , float $llx , float $lly , float $urx , float $ury , string $filename ) - Places a hyperlink at the given position pointing to a file program which is being started when clicked on. The hyperlink's source position is a rectangle with its lower left corner at (llx, lly) and its upper right corner at (urx, ury). The rectangle has by default a thin blue border.

bool ps_add_locallink ( resource $psdoc , float $llx , float $lly , float $urx , float $ury , int $page , string $dest ) - Places a hyperlink at the given position pointing to a page in the same document. Clicking on the link will jump to the given page. The first page in a document has number 1.

bool ps_add_note ( resource $psdoc , float $llx , float $lly , float $urx , float $ury , string $contents , string $title , string $icon , int $open ) - Adds a note at a certain position on the page. Notes are like little rectangular sheets with text on it, which can be placed anywhere on a page. They are shown either folded or unfolded. If unfolded, the specified icon is used as a placeholder.

bool ps_add_pdflink ( resource $psdoc , float $llx , float $lly , float $urx , float $ury , string $filename , int $page , string $dest ) - Places a hyperlink at the given position pointing to a second pdf document. Clicking on the link will branch to the document at the given page. The first page in a document has number 1.

bool ps_add_weblink ( resource $psdoc , float $llx , float $lly , float $urx , float $ury , string $url ) - Places a hyperlink at the given position pointing to a web page. The hyperlink's source position is a rectangle with its lower left corner at (llx, lly) and its upper right corner at (urx, ury). The rectangle has by default a thin blue border.

bool ps_arc ( resource $psdoc , float $x , float $y , float $radius , float $alpha , float $beta ) - Draws a portion of a circle with at middle point at (x, y). The arc starts at an angle of alpha and ends at an angle of beta.

bool ps_arcn ( resource $psdoc , float $x , float $y , float $radius , float $alpha , float $beta ) - Draws a portion of a circle with at middle point at (x, y). The arc starts at an angle of alpha and ends at an angle of beta.

bool ps_begin_page ( resource $psdoc , float $width , float $height ) - Starts a new page. Although the parameters width and height imply a different page size for each page, this is not possible in PostScript. The first call of ps_begin_page() will set the page size for the whole document. Consecutive calls will have no effect, except for creating a new page. The situation is different if you intent to convert the PostScript document into PDF. This function places pdfmarks into the document which can set the size for each page indiviually. The resulting PDF document will have different page sizes.

int ps_begin_pattern ( resource $psdoc , float $width , float $height , float $xstep , float $ystep , int $painttype ) - Starts a new pattern. A pattern is like a page containing e.g. a drawing which can be used for filling areas.

int ps_begin_template ( resource $psdoc , float $width , float $height ) - Starts a new template. A template is called a form in the postscript language. It is created similar to a pattern but used like an image. Templates are often used for drawings which are placed several times through out the document, e.g. like a company logo. All drawing functions may be used within a template.

bool ps_circle ( resource $psdoc , float $x , float $y , float $radius ) - Draws a circle with its middle point at (x, y). The circle starts and ends at position (x+radius, y). If this function is called outside a path it will start a new path. If it is called within a path it will add the circle as a subpath. If the last drawing operation does not end in point (x+radius, y) then there will be a gap in the path.

bool ps_clip ( resource $psdoc ) - Takes the current path and uses it to define the border of a clipping area. Everything drawn outside of that area will not be visible.

bool ps_close ( resource $psdoc ) - Closes the PostScript document.

void ps_close_image ( resource $psdoc , int $imageid ) - Closes an image and frees its resources. Once an image is closed it cannot be used anymore.

bool ps_closepath ( resource $psdoc ) - Connects the last point with the first point of a path. The resulting path can be used for stroking, filling, clipping, etc..

bool ps_closepath_stroke ( resource $psdoc ) - Connects the last point with first point of a path and draws the resulting closed line.

bool ps_continue_text ( resource $psdoc , string $text ) - Output a text one line below the last line.

bool ps_curveto ( resource $psdoc , float $x1 , float $y1 , float $x2 , float $y2 , float $x3 , float $y3 ) - Add a section of a cubic Bézier curve described by the three given control points to the current path.

bool ps_delete ( resource $psdoc ) - Mainly frees memory used by the document.

bool ps_end_page ( resource $psdoc ) -

bool ps_end_pattern ( resource $psdoc ) -

bool ps_end_template ( resource $psdoc ) -

bool ps_fill ( resource $psdoc ) -

bool ps_fill_stroke ( resource $psdoc ) -

int ps_findfont ( resource $psdoc , string $fontname , string $encoding [, bool $embed ] ) - Loads a font for later use.

string ps_get_buffer ( resource $psdoc ) - This function is not implemented yet. It will always return an empty string. The idea for a later implementation is to write the contents of the postscript file into an internal buffer if in memory creation is requested, and retrieve the buffer content with this function. Currently, documents created in memory are send to the browser without buffering.

string ps_get_parameter ( resource $psdoc , string $name [, float $modifier ] ) -

float ps_get_value ( resource $psdoc , string $name [, float $modifier ] ) -

array ps_hyphenate ( resource $psdoc , string $text ) - Hyphenates the passed word.

bool ps_lineto ( resource $psdoc , float $x , float $y ) - Adds a straight line from the current point to the given coordinates to the current path.

int ps_makespotcolor ( resource $psdoc , string $name [, float $reserved ] ) - Creates a spot color from the current fill color. The fill color must be defined in rgb, cmyk or gray colorspace. The spot color name can be an arbitrary name.

bool ps_moveto ( resource $psdoc , float $x , float $y ) - Sets the current point to new coordinates. If this is the first call of ps_moveto() after a previous path has been ended then it will start a new path. If this function is called in the middle of a path it will just set the current point and start a subpath.

resource ps_new ( void ) - Creates a new document instance. It does not create the file on disk or in memory, it just sets up everything.

bool ps_open_file ( resource $psdoc [, string $filename ] ) - Creates a new file on disk and writes the PostScript document into it.

int ps_open_image ( resource $psdoc , string $type , string $source , string $data , int $lenght , int $width , int $height , int $components , int $bpc , string $params ) - Reads an image which is already available in memory. The parameter source is currently not evaluated and assumed to be memory. The image data is a sequence of pixels starting in th upper left corner and ending in the lower right corner. Each pixel consists of components color components, and each component has bpc bits.

int ps_open_image_file ( resource $psdoc , string $type , string $filename [, string $stringparam [, int $intparam ]] ) - Loads an image for later use.

bool ps_place_image ( resource $psdoc , int $imageid , float $x , float $y , float $scale ) - Places a formerly loaded image on the page. The image can be scaled.

bool ps_rect ( resource $psdoc , float $x , float $y , float $width , float $height ) - Draws a rectangle with its lower left corner at (x, y). The rectangle starts and ends in its lower left corner. If this function is called outside a path it will start a new path. If it is called within a path it will add the rectangle as a subpath. If the last drawing operation does not end in the lower left corner then there will be a gap in the path.

bool ps_restore ( resource $psdoc ) - Restores a previously saved graphics context.

bool ps_rotate ( resource $psdoc , float $rot ) - Sets the rotation of the coordinate system.

bool ps_save ( resource $psdoc ) - Saves the current graphics context, containing colors, translation and rotation settings and some more.

bool ps_scale ( resource $psdoc , float $x , float $y ) - Sets horizontal and vertical scaling of the coordinate system.

bool ps_set_border_color ( resource $psdoc , float $red , float $green , float $blue ) -

bool ps_set_border_dash ( resource $psdoc , float $black , float $white ) -

bool ps_set_border_style ( resource $psdoc , string $style , float $width ) -

bool ps_set_info ( resource $p , string $key , string $val ) - Sets certain information fields of the document. This fields will be shown as a comment in the header of the PostScript file. If the document is converted to pdf this fields will also be used for the document information.

bool ps_set_parameter ( resource $psdoc , string $name , string $value ) - Sets several parameters which are used by many functions. Parameters are by definition string values.

bool ps_set_text_pos ( resource $psdoc , float $x , float $y ) - Set the position for the next text output.

bool ps_set_value ( resource $psdoc , string $name , float $value ) - Sets several values which are used by many functions. Parameters are by definition float values.

bool ps_setcolor ( resource $psdoc , string $type , string $colorspace , float $c1 , float $c2 , float $c3 , float $c4 ) - Sets the color for drawing, filling, or both.

bool ps_setdash ( resource $psdoc , float $on , float $off ) - Sets the length of the black and white portions of a dashed line.

bool ps_setfont ( resource $psdoc , int $fontid , float $size ) -

bool ps_setgray ( resource $psdoc , float $gray ) - Sets the gray value for all following drawing operations.

bool ps_setlinecap ( resource $psdoc , int $type ) - Sets how line ends look like.

bool ps_setlinejoin ( resource $psdoc , int $type ) - Sets how lines are joined.

bool ps_setlinewidth ( resource $psdoc , float $width ) - Sets the line width for all following drawing operations.

bool ps_setmiterlimit ( resource $psdoc , float $value ) - If two lines join in a small angle and the line join is set to PS_LINEJOIN_MITER, then the resulting spike will be very long. The miter limit is the maximum ratio of the miter length (the length of the spike) and the line width.

bool ps_setpolydash ( resource $psdoc , float $arr ) - Sets the length of the black and white portions of a dashed line. ps_setpolydash() is used to set more complicated dash patterns.

int ps_shading ( resource $psdoc , string $type , float $x0 , float $y0 , float $x1 , float $y1 , float $c1 , float $c2 , float $c3 , float $c4 , string $optlist ) -

int ps_shading_pattern ( resource $psdoc , int $shadingid , string $optlist ) -

bool ps_shfill ( resource $psdoc , int $shadingid ) -

bool ps_show ( resource $psdoc , string $text ) - Output a text at the current text position.

int ps_show_boxed ( resource $psdoc , string $text , float $left , float $bottom , float $width , float $height , string $hmode [, string $feature ] ) - Outputs a text in a given box. The lower left corner of the box is at (left, bottom). Line breaks will be inserted where needed. Multiple spaces are treated as one. Tabulators are treated as spaces.

bool ps_show_xy ( resource $psdoc , string $text , float $x , float $y ) - Output a text at the given text position.

array ps_string_geometry ( resource $psdoc , string $text [, int $fontid [, float $size ]] ) -

float ps_stringwidth ( resource $psdoc , string $text [, int $fontid [, float $size ]] ) - Calculates the width of a string in points if it was output in the given font and font size. This function needs an Adobe font metrics file to calculate the precise width. If kerning is turned on, it will be taken into account.

bool ps_stroke ( resource $psdoc ) -

bool ps_symbol ( resource $psdoc , int $ord ) - Output the glyph at position ord in the font encoding vector of the current font.

string ps_symbol_name ( resource $psdoc , int $ord [, int $fontid ] ) - This function needs an Adobe font metrics file to know which glyphs are available.

float ps_symbol_width ( resource $psdoc , int $ord [, int $fontid [, float $size ]] ) - Calculates the width of a glyph in points if it was output in the given font and font size. This function needs an Adobe font metrics file to calculate the precise width.

bool ps_translate ( resource $psdoc , float $x , float $y ) - Sets a new initial point of the coordinate system.