Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
PHP: pdf_rect - Manual
[go: Go Back, main page]

PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  
<pdf_place_pdi_pagepdf_restore" width="11" height="7"/>
view the version of this page
Last updated: Tue, 21 Dec 2004

pdf_rect

(PHP 3>= 3.0.6, PHP 4 , PHP 5)

pdf_rect -- 長方形を描く

説明

void pdf_rect ( int pdf object, float x, float y, float width, float height)

(x, y) を左下隅とし、 幅を width、高さを heightとする長方形を描画します。



add a note add a note User Contributed Notes
pdf_rect
tobias at midas dot se
16-May-2002 06: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 09: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_place_pdi_pagepdf_restore" width="11" height="7"/>
 Last updated: Tue, 21 Dec 2004
show source | credits | sitemap | contact | advertising | mirror sites 
Copyright © 2001-2005 The PHP Group
All rights reserved.
This mirror generously provided by: HappySize, Inc.
Last updated: Sat Jan 15 06:11:01 2005 JST