

object PDF.pdf();
	create an empty pdf object in memory

object PDF.pdf("/path/to/file.pdf");
	create or open a pdf file

object pdf=PDF.pdf();

pdf->set_info( string key, string value)
	fill document information field <key> with <value>. The keys
	can be:	
		Subject		Subject of the document
		Title		Title of the document
		Creator		Creator of the document
		Author		Author of the document
		Keywords	Keywords describing the contents of the 
				document
		<any custom>	User-defined field name. PDFlib supports
				one additional field which may be arbitrary
				named.

pdf->begin_page( float width, float height );
	Start a new page in the PDF file. The <width> and <height>
	parameters are the dimensions of the new page in points.
	1pt == 1 inch / 72 == 25.4 mm / 72 == 0.3528 mm

	common standard page size dimensions
	page format	width	height
	a0		2380	3368
	a1		1684	2380
	a2		1190	1684
	a3		842	1190
	a4		595	842
	a5		421	595
	a6		297	421
	b5		501	709
	letter		612	794
	legal		612	1008
	ledger		1224	792
	11x17		792	1224
	
	pdf->begin_page() must always be paired with a matching 
	pdf->end_page() call

pdf->end_page();
	Must be used to finish a page description.

pdf->close();
	Finish the generated PDF document, free all document-related
	resources, and close the output file if the PDF document has
	been been opened with PDF.pdf(filename);. This function
	must be called when the client is done generating pages, regardless
	of the methid used to open the PDF document.
	When the document was generated in memory, the document buffer will
	still be kept after this function called.
	see pdf->generate(); for memory method details.

pdf->generate();
	after a pdf->close() you can have the generated PDF file
	if you  used the memory method (PDF.pdf();)

int pdf->findfont( string fontname, string encoding, int embed )
	Prepare the font <fontname> for later use with pdf->setfont().

pdf->setfont( int font, float size );
	Set the current font int he given fontsize. The font descriptor must
	have been retrieved with pdf->findfont(). The font must be set on
	each page befire drawing any text. Font settings will not be
	retained across pages. The current font can be changed an arbitrary
	number of times per page.

pdf->show( string text, int|void len);
	Print <text> in the current font and font size at the current text
	position. Both font (via pd->setfont();) and current point 
	(via pdf->moveto() or another text output function)
	must have been set before. The current point is moved to the end of
	the printed text.
	An optional <len> argument specifies the maximum length.

pdf->show_boxed( string text, float x, float y, float width, float height,
				string mode, string feature )
	Format the supplied <text> into a rectangular column. mode selects the 
	horizontal alignment mode as discussed below.
		If width=0 and height=0, mode can attain one of the values 
	left, right or center, and the text will be formatted according to the 
	chosen alignment with respect to the point (x,y), with y denoting the 
	position of the baseline. In this mode, this function does not check  
	whether the submitted parameters result in some text being clipped at the
	page edges, nor does it apply any line-wrapping. It returns the value of 0
	in this case.
	If width or height is different from 0, mode can attain one of the values 
	left, right justify, or fulljustify. The supplied text will be formatted 
	into a text box deined by the lower left corner (x,y) and the supplied 
	width and height. If the text doesn't fit into a line, a simple 
	line-breaking algorithm is used to break the text into the next available 
	line, using existing space characters for possible line-breaks. While the
	left, right, and center modes align the text on the respective line, 
	justify aligns the text on both left and right margins. According to 
	common practice the very last line in the box will only be left-aligned
	in justify mode, while in fulljustify mode all lines (including the last
	one if it contains at least one space character) will be left- and 
	right-aligned. fulljustify is useful if the text is to be continued in 
	another column.
		This function returns the numer of characters which could not be 
	processed since the text didn't completely fit into the column. If the 
	text did actually fit, it returns 0.
	Since no formatting is performed if width=0 and height=0, this function
	always return 0 in this case.
		The current font must have been set before calling this function. The
	current values of font, font size, horizontal spacing, and leading are 
	used fpr the text.
		If the feature parameter is <blind>, all calculations are performed, 
	but no text output is actually generated. This can be used for size 
	calculations and possibly trying different font sizes for fitting some 
	amount of text into a given box by varying the font size. Otherwise 
	feature must be empty ("").

pdf->continue_text( string text, int|void len );
	Move to the next line and print <text>. The start of the next line
	is determinated by the leading parameter and the most recent call to
	pdf->show(). The current point is moved to the end of the printed
	text. 
	An optional <len> argument specifies the maximum length.

pdf->set_text_pos( float x, float y );
	Set the current text position to (x,y).

float pdf->stringwidth(	string text, int font, float size );
float pdf->stringwidth(	string text, int len, int font, float size );
	REturn the width of <text> in an arbitrary font and size which 
	has been selected with pdf->findfont(). The width calcualtion tages
	the current values of the following text parameters into account:
	horizontal scaling, character spacing, and wird spacing. 
	An optional <len> argument specifies the maximum length.


pdf->setdash( float b, float w )
	Set the current dash pattern to <b> black and <w> white units. 
	<b> and <w> must be non-negative numbers. In order to produce a solid line, 	set b=w=0. The dash parameter is set to solid at the beginning of 
	each page.

pdf->setlinewidth( float width )
	Set the current line width to <width> units in the user coordinate system. 
	The linewidth parameter is set to the default value of 1 at the 
	beginning of each page.

pdf->moveto( float x, float y )
	Set tge current point to (x,y). The current point is set to the default 
	value undefined at the beginning of each page.
	Note: The current point for graphics output and the current text position 
		are maintained separately.

pdf->lineto( float x, float y )
	Add a straight line from the current point to (x,y) to the current path.
	The current point must be set before using this function. 
	The point (x,y) becomes the new current point.
		The line will be centered around the >>ideal<< line. i.e. half of 
	the linewidth (as determinated by the value of the linewidth parameter)
	will be painted on each side of the line connecting both endpoints.
	The behavior at the endpoints us determined by tge values of the 
	linecap parameter. 

pdf->curveto( float x1, float y1, float x2, float y2, float x3, float y3 )
	Add a Bezier curve from the current point to (x3,y3) to the current path, 
	using (x1,y1) and (x2,y2) as control points. The endpoint of the curve
	becomes the new current point.

pdf->circle( float x, float y, float r )
	Add a curcle with center (x,y) and radius r to the current path. The point
	(x+r,y) becomes the new current point. Elliptical curves can be constructed
	by applying non-uniform scaling factors before drawing the circle.

pdf->arc( float x, float y, float r, float start, float end )
	Add a curcular arc segment with center (x,y) and radius r to the current
	path, extending from start to end degrees. Angles are measured 
	counterclockwie from the positive x axis of the current coordinate system.
	Before drawing the arc segment, this function implicitly moves the 
	current point to the beginning of the arc. The endpoint of the arc
	becomes the new current point.

pdf->rect( float x, float y, float width, float height )
	Add a rectangle with lower left corner (x,y) and the supplied <width> and
	<height> to the current path. Setting the current point is not required 
	before using this function. The point (x,y) becomes the new current point.
	The lines will be centered around the >>ideal<< line, i.e. half of the
	linewidth (as determinated by the value of the linewidth parameter)
	will be painted on each side of the line connecting the respective 
	endpoints.

pdf->stroke()
	Stroke (draw) the current path with the current line width and the current 
	stroke color. This operation clears the path.

pdf->fill()
	Fill the interior of the current path with the current fill color. The
	interior of the path is determined by one of two algorithms 
	(see pdf->setfillrule()). Open paths are implicitly closed before being
	filled. This operation clears the path.

Color Functions:
pdf->setgray_fill( float gray )
	Set the current fill color to the <gray> value. The gray fill parameter 
	is set to the default value of 0 at the beginning of each page.

pdf->setgray_stroke( float gray )
	Set the current stroke color to the <gray> value. The gray stroke 
	parameter is set to the default value of 0 at the geinning of each page.

pdf->setgray( float gray )
	Set the current fill and stroke color to the <gray> value. The gray 
	parameter is set to the default value of 0 at the geinning of each page.

pdf->setrgbcolor_fill( float red, float green, float blue )
	Set the current fill color to the supplied RGB values. The rgbcolor fill
	parameter is set to the default value of (0,0,0) at the beginning of each
	page.

pdf->setrgbcolor_stroke( float red, float green, float blue )
	Set the current stroke color to the supplied RGB values. The rgbcolor 
	stroke parameter is set to the default value of (0,0,0) at the 
	beginning of each page.

pdf->setrgbcolor( float red, float green, float blue )
	Set the current fill and stroke color to the supplied RGB values. 
	The rgbcolor parameter is set to the default value of (0,0,0) at the 
	beginning of each page.

Parameter Handling:
float pdf->get_value( string key, float|void modifier )
	Get the numerical value of some internal PDFlib parameter <key>, in 
	some cases characterized by the modifier. For parameters where the 
	description doesn't mention modifier, it is ignored and must not given.

pdf->set_value( string key, float value )
	Set some numerical PDFlib parameter <key> to <value>.

string pdf->get_parameter( string key, float|void modifier )
	Get the string value of some PDFlib parameter <key>, in some cases further 
	characterized by modifier.

pdf->set_parameter( string key, string value )
	Set the string value of some PDFlib parameter <key> to <value>.

int pdf->add_bookmark( string text, int parent, int open )
	Add a PDF bookmark with the supplied <text> that points to the current 
	page. This function must not be called before starting the first page of 
	the document with pdf->begin_page().
	This function returns an identifier for the bookmark just generated. This
	identifier may be used as the parent parameter is subsequent calls. In 
	this case, a new bookmark will be generated which is a subordinate of the 
	given parent. In this way, arbitrarily nested bookmarks can be generated. 
	If parent = 0 a new top-level bookmark will be generated. If the open 
	parameter has a value of 0, child bookmarks will not be visible. 
	If open = 1, all children will be folded out.

