PHP. PostscriptSummary | | | | | Sets the percentage of line height that belongs to the font. | | This table defines the filenames that are associated with the font descriptions. | | | | | | | | | | Show some centeredtext at specific coordinates | | Show some centered text at specific coordinates with font settings | | Close the postscript file | | Determine “x” value by the absolute position from the upper left hand corner horizontally. | | Determine “y” value by the absolute position from the upper left hand corner vertically. | | | | | | Move to coordinates and change the font | | Insert a PS file/image (remember to delete the information in the top of the file (source)) | | | | Draw and shade a rectangle | | Set rotation, use 0 or 360 to end rotation | | | | Show some text at the current coordinates (use ‘moveto’ to set coordinates) | | Evaluate the text and show it at the current coordinates | | Show some text at specific coordinates | | Show some text at specific coordinates with font settings | | Creates a text virtual bounding box, to determine whether text will fit in a certain area | | Returns the last bottom Y coordinate of a virtual text bounding box. | | Convert X coordinate to horizontal measurement | | Convert Y coordinate to vertical measurement | | Internal function to determine the split of a string while still fitting within a virtual boundary | | Internal method to determine maximum height of a string in the designated font and size. | | Internal method to determine length of a string in the designated font and size. |
Postscript->spacing_multiplierSets the percentage of line height that belongs to the font. (example: if this is set to 0.8, 80% of the space is taken up by the font, and the remaining 20% is space)
Postscript->font_tableThis table defines the filenames that are associated with the font descriptions. They are used so that PHP can correctly load the fonts to determine what text line widths are. These come in the Debian ‘gsfonts’ package.
Postscript constructorParameters$fname | File name for output | $_options | (optional) Associative array of optional parameters. |
- title - Title of generated page. Defaults to ‘Generated with PSLib’.
- orientation - Orientation of generated page. Defaults to ‘Portrait’.
- paper - Paper size. Defaults to ‘letter’.
- author - Author name. Defaults to ‘phpwebtools/PSLib’.
begin_pagefunction begin_page( | $page | ) |
|
Begin new page Parameters
center_xyfunction center_xy( | $text, | | $xcoord, | | $ycoord | ) |
|
Show some centeredtext at specific coordinates Parameters$text | Text to display | $xcoord | X coordinate | $ycoord | Y coordinate |
center_xy_fontfunction center_xy_font( | $text, | | $xcoord, | | $ycoord, | | $font_name, | | $font_size | ) |
|
Show some centered text at specific coordinates with font settings Parameters$text | Text to display | $xcoord | X coordinate | $ycoord | Y coordinate | $font_name | Name of the font to be used | $font_size | Size of the font to be used |
closeClose the postscript file
inches_to_xDetermine “x” value by the absolute position from the upper left hand corner horizontally. Returns a point value. Parameters$i | Horizontal position from left side of the paper in inches. |
ReturnsX point value
inches_to_yDetermine “y” value by the absolute position from the upper left hand corner vertically. Returns a point value. Parameters$i | Vertical position from top of the paper in inches. |
ReturnsY point value
linefunction line( | $xcoord_from | = | 0, | | $ycoord_from | = | 0, | | $xcoord_to | = | 0, | | $ycoord_to | = | 0, | | $linewidth | = | 0 | ) |
|
Draw a line Parameters$xcoord_from | Origin X position of the line | $ycoord_from | Origin Y position of the line | $xcoord_to | Destination X position of the line | $ycoord_to | Destination Y position of the line | $linewidth | Width of the line in points |
movetofunction moveto( | $xcoord, | | $ycoord | ) |
|
Move to coordinates Parameters$xcoord | Destination X coordinate | $ycoord | Destination Y coordinate |
moveto_fontfunction moveto_font( | $xcoord, | | $ycoord, | | $font_name, | | $font_size | ) |
|
Move to coordinates and change the font Parameters$xcoord | Destination X coordinate | $ycoord | Destination Y coordinate | $font_name | Name of the font | $font_size | Point size of the font |
open_psfunction open_ps( | $ps_file | = | "" | ) |
|
Insert a PS file/image (remember to delete the information in the top of the file (source)) Parameters$ps_file | Name of the file to join into the current rendering |
rectfunction rect( | $xcoord_from, | | $ycoord_from, | | $xcoord_to, | | $ycoord_to, | | $linewidth | ) |
|
Draw a rectangle Parameters$xcoord_from | Origin X position of the upper left corner | $ycoord_from | Origin Y position of the upper left corner | $xcoord_to | Destination X position of the lower right corner | $ycoord_to | Destination Y position of the lower right corner | $linewidth | Width of the lines in points |
rect_fillfunction rect_fill( | $xcoord_from, | | $ycoord_from, | | $xcoord_to, | | $ycoord_to, | | $linewidth, | | $darkness | ) |
|
Draw and shade a rectangle Parameters$xcoord_from | Origin X position of the upper left corner | $ycoord_from | Origin Y position of the upper left corner | $xcoord_to | Destination X position of the lower right corner | $ycoord_to | Destination Y position of the lower right corner | $linewidth | Width of the lines in points | $darkness | Darkness, in 0 .. 1 value. |
rotatefunction rotate( | $degrees | ) |
|
Set rotation, use 0 or 360 to end rotation Parameters$degrees | Degrees to rotate the current drawing aspect |
set_fontfunction set_font( | $font_name, | | $font_size | ) |
|
Set the font to show Parameters$font_name | Name of the font | $font_size | Point size of the font |
showShow some text at the current coordinates (use ‘moveto’ to set coordinates) See Alsomoveto
show_evalfunction show_eval( | $_text | ) |
|
Evaluate the text and show it at the current coordinates Parameters$text | Text with php variable expressions |
show_xyfunction show_xy( | $text, | | $xcoord, | | $ycoord | ) |
|
Show some text at specific coordinates Parameters$text | Text to display | $xcoord | X coordinate of origin point | $ycoord | Y coordinate of origin point |
show_xy_fontfunction show_xy_font( | $text, | | $xcoord, | | $ycoord, | | $font_name, | | $font_size | ) |
|
Show some text at specific coordinates with font settings Parameters$text | Text to display | $xcoord | X coordinate of origin point | $ycoord | Y coordinate of origin point | $font_name | Name of the font | $font_size | Size of the font |
text_vbboxfunction text_vbbox ( | $string, | | | | $font, | | | | $size, | | | | $tx, | | | | $ty, | | | | $bx, | | | | $by | = | -1 | ) |
|
Creates a text virtual bounding box, to determine whether text will fit in a certain area Parameters$string | Text string to be displayed. Line breaks with line break characters are honored, otherwise text is wrapped at the edge of the box. | $font | Name of the font to be used | $size | Size of the font to be used | $tx | Top left X coordinate for the bounding box | $ty | Top left Y coordinate for the bounding box | $bx | Bottom right X coordinate for the bounding box | $by | (optional) Bottom right Y coordinate for the bounding box. If this is not set, this is not considered to be a fixed size bounding box, and the Y parameter will expand until either the page ends or the text is exhausted. |
text_vbbox_bottomfunction text_vbbox_bottom() |
Returns the last bottom Y coordinate of a virtual text bounding box. ReturnsY coordinate, or false if there was no Y coordinate computed. See Alsotext_vbbox
x_to_inchesConvert X coordinate to horizontal measurement Parameters$p | Position as X coordinate in points |
ReturnsHorizontal inches measurement from the top left of the page.
y_to_inchesConvert Y coordinate to vertical measurement Parameters$p | Position as Y coordinate in points |
ReturnsVertical inches measurement from the top left of the page.
_get_string_splitfunction _get_string_split ( | $font, | | $size, | | $_string, | | $width | ) |
|
Internal function to determine the split of a string while still fitting within a virtual boundary Parameters$font | Font to use | $size | Size of the font to use | $_string | Text string to split | $width | Width of virtual bounding box in points |
ReturnsPosition to split the string at.
_get_text_heightfunction _get_text_height ( | $font, | | $size, | | $string | ) |
|
Internal method to determine maximum height of a string in the designated font and size. Parameters$font | Font to be used | $size | Size of the font to be used | $string | Text string |
ReturnsHeight in points.
_get_text_lengthfunction _get_text_length ( | $font, | | $size, | | $string | ) |
|
Internal method to determine length of a string in the designated font and size. Parameters$font | Font to be used | $size | Size of the font to be used | $string | Text string |
ReturnsLength in points
|