suche nach in der

PDF_restore> <PDF_process_pdi
Last updated: Fri, 18 May 2012

view this page in

PDF_rect

(PHP 4, PECL pdflib >= 1.0.0)

PDF_rectZeichnet Rechteck

Beschreibung

bool PDF_rect ( resource $p , float $x , float $y , float $width , float $height )

Zeichnet ein Rechteck. Gibt bei Erfolg TRUE zurück. Im Fehlerfall wird FALSE zurückgegeben.



add a note add a note User Contributed Notes
PDF_rect
stuart at horuskol dot co dot uk
09-Jun-2006 11:14
This section of the manual is really sparse, and there don't seem to be any tutorials out there that go beyond adding a single line of text, so I found this piece of information out by trial and error.

The function only specifies that you want a rectangle at those co-ordinates, and must be followed by a stroke command:

  pdf_rect($pdf, 100, 100, 50, 50);
  pdf_stroke($pdf);

This completes the process of placing the rectangle on the page.
ragnar at deulos dot com
04-Oct-2005 08:09
Be sure of adding a pdf_stroke(resource_pdf) after the pdf_rect function or will take an error in the PDFlib.
tobias at midas dot se
16-May-2002 11:31
Round rectangles

My function to create rectangles width round corners:

<?php
function pdf_roundrect($pdfobj, $xpos, $ypos, $xsize, $ysize, $radius)
{
 
$ypos = $ypos+$ysize;
 
pdf_moveto($pdfobj, $xpos, $ypos-$radius);
 
pdf_lineto($pdfobj, $xpos, $ypos-$ysize+$radius);
 
pdf_arc($pdfobj, $xpos+$radius, $ypos-$ysize+$radius, $radius, 180, 270);
 
pdf_lineto($pdfobj, $xpos+$xsize-$radius, $ypos-$ysize);
 
pdf_arc($pdfobj, $xpos+$xsize-$radius, $ypos-$ysize+$radius, $radius, 270, 360);
 
pdf_lineto($pdfobj, $xpos+$xsize, $ypos-$radius);
 
pdf_arc($pdfobj, $xpos+$xsize-$radius, $ypos-$radius, $radius,0,90);
 
pdf_lineto($pdfobj, $xpos+$radius, $ypos);
 
pdf_arc($pdfobj, $xpos+$radius, $ypos-$radius, $radius,90,180);
}
?>
02-Aug-2001 02:26
This will draw a simple rectangle...
...with a few extras.

<?php

//Create & Open PDF-Object
$pdf = pdf_new();
pdf_open_file($pdf);
pdf_set_info($pdf, "Author","Bob Nijman");
pdf_set_info($pdf, "Title","www.nijman.de");
pdf_set_info($pdf, "Creator", "bob@nijman.de");
pdf_set_info($pdf, "Subject", "pdf-stuff");
pdf_begin_page($pdf, 200, 200);


// just a simple rectangle
pdf_setlinewidth($pdf, 5); //make the border of the rectangle a bit wider
pdf_rotate($pdf, 5); //rotate the coordinate system (NOT THE RECTANGLE !!!!!)
pdf_rect($pdf, 100, 100, 50, 50); //draw the rectangle
pdf_stroke($pdf); //stroke the path with the current color(not yet :-)) and line width

//note: the rect is not drawn untill we use pdf_stroke - try it out!!!

//close it up
pdf_end_page($pdf);
pdf_close($pdf);
$data = pdf_get_buffer($pdf);
header('Content-type: application/pdf');
header('Content-disposition: inline; filename=invoice.pdf');
header('Content-length: ' . strlen($data));
echo
$data;

?>

Thanx to:
http://www.dynamicwebpages.de/50.tutorials.php?dwp_tutorialID=11
Great german (!!!) tutorial

PDF_restore> <PDF_process_pdi
Last updated: Fri, 18 May 2012