PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  
<cpdf_place_inline_imagecpdf_restore>
Last updated: Mon, 16 Jul 2012

cpdf_rect

(PHP 3 >= 3.0.8, PHP 4, PECL)

cpdf_rect -- Draw a rectangle

Description

bool cpdf_rect ( int pdf_document, float x_coor, float y_coor, float width, float height [, int mode] )

The cpdf_rect() function draws a rectangle with its lower left corner at point (x_coor, y_coor). This width is set to width. This height is set to height. 如果成功则返回 TRUE,失败则返回 FALSE

可选参数 mode 决定单元的长度。如果为 0 或被省略则使用该页指定的默认单元。否则坐标忽略当前单元而使用 postscript 的点来度量。

例子 1. Drawing a rectangle

<?php

$cpdf
= cpdf_open(0);
cpdf_page_init($cpdf, 1, 0, 595, 842, 1.0);

// set the fill color to red
cpdf_setrgbcolor($cpdf, 1, 0, 0);

// draw a (180 * 100) rectangle
cpdf_rect($cpdf, 645, 400, 180, 100);

// fill the rectangle
cpdf_fill($cpdf);

cpdf_finalize($cpdf);
Header("Content-type: application/pdf");
cpdf_output_buffer($cpdf);
cpdf_close($cpdf);

?>




<cpdf_place_inline_imagecpdf_restore>
 Last updated: Mon, 16 Jul 2012
 
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://manual.phpv.net/
Last updated: Thu Jul 7 19:13:47 2005 CST