本文整理汇总了PHP中Cpdf::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Cpdf::__construct方法的具体用法?PHP Cpdf::__construct怎么用?PHP Cpdf::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cpdf
的用法示例。
在下文中一共展示了Cpdf::__construct方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* $type : { 'none' | 'color' | 'colour' | 'image' }
* $options : if type == 'color' or 'colour':
* $options[0] = red-component of backgroundcolour ( 0 <= r <= 1)
* $options[1] = green-component of backgroundcolour ( 0 <= g <= 1)
* $options[2] = blue-component of backgroundcolour ( 0 <= b <= 1)
* if type == 'image':
* $options['img'] = location of image file; URI's are allowed if allow_url_open is enabled in php.ini
* $options['width'] = width of background image; default is width of page
* $options['height'] = height of background image; default is height of page
* $options['xpos'] = horizontal position of background image; default is 0
* $options['ypos'] = vertical position of background image; default is 0
* *new* $options['repeat'] = repeat image horizontally (1), repeat image vertically (2) or full in both directions (3); default is 0
* highly recommend to set this->hashed to true when using repeat function
*
* Assuming that people don't want to specify the paper size using the absolute coordinates
* allow a couple of options:
* orientation can be 'portrait' or 'landscape'
* or, to actually set the coordinates, then pass an array in as the first parameter.
* the defaults are as shown.
*
* 2002-07-24 - Nicola Asuni (info@tecnick.com):
* Added new page formats (45 standard ISO paper formats and 4 american common formats)
* paper cordinates are calculated in this way: (inches * 72) where 1 inch = 2.54 cm
*
* Now you may also pass a 2 values array containing the page width and height in centimeters
*
* @param $paper
* @param $orientation
* @param $type
* @param $options
* @return unknown_type
*/
public function __construct($paper = 'a4', $orientation = 'portrait', $type = 'none', $options = array())
{
if (!is_array($paper)) {
switch (strtoupper($paper)) {
case '4A0':
$size = array(0, 0, 4767.87, 6740.79);
break;
case '2A0':
$size = array(0, 0, 3370.39, 4767.87);
break;
case 'A0':
$size = array(0, 0, 2383.94, 3370.39);
break;
case 'A1':
$size = array(0, 0, 1683.78, 2383.94);
break;
case 'A2':
$size = array(0, 0, 1190.55, 1683.78);
break;
case 'A3':
$size = array(0, 0, 841.89, 1190.55);
break;
case 'A4':
default:
$size = array(0, 0, 595.28, 841.89);
break;
case 'A5':
$size = array(0, 0, 419.53, 595.28);
break;
case 'A6':
$size = array(0, 0, 297.64, 419.53);
break;
case 'A7':
$size = array(0, 0, 209.76, 297.64);
break;
case 'A8':
$size = array(0, 0, 147.4, 209.76);
break;
case 'A9':
$size = array(0, 0, 104.88, 147.4);
break;
case 'A10':
$size = array(0, 0, 73.7, 104.88);
break;
case 'B0':
$size = array(0, 0, 2834.65, 4008.19);
break;
case 'B1':
$size = array(0, 0, 2004.09, 2834.65);
break;
case 'B2':
$size = array(0, 0, 1417.32, 2004.09);
break;
case 'B3':
$size = array(0, 0, 1000.63, 1417.32);
break;
case 'B4':
$size = array(0, 0, 708.66, 1000.63);
break;
case 'B5':
$size = array(0, 0, 498.9, 708.66);
break;
case 'B6':
$size = array(0, 0, 354.33, 498.9);
break;
case 'B7':
$size = array(0, 0, 249.45, 354.33);
//.........这里部分代码省略.........
示例2: switch
function __construct($paper = 'a4', $orientation = 'portrait')
{
// Assuming that people don't want to specify the paper size using the absolute coordinates
// allow a couple of options:
// orientation can be 'portrait' or 'landscape'
// or, to actually set the coordinates, then pass an array in as the first parameter.
// the defaults are as shown.
//
// -------------------------
// 2002-07-24 - Nicola Asuni (info@tecnick.com):
// Added new page formats (45 standard ISO paper formats and 4 american common formats)
// paper cordinates are calculated in this way: (inches * 72) where 1 inch = 2.54 cm
//
// Now you may also pass a 2 values array containing the page width and height in centimeters
// -------------------------
if (!is_array($paper)) {
switch (strtoupper($paper)) {
case '4A0':
$size = array(0, 0, 4767.87, 6740.79);
break;
case '2A0':
$size = array(0, 0, 3370.39, 4767.87);
break;
case 'A0':
$size = array(0, 0, 2383.94, 3370.39);
break;
case 'A1':
$size = array(0, 0, 1683.78, 2383.94);
break;
case 'A2':
$size = array(0, 0, 1190.55, 1683.78);
break;
case 'A3':
$size = array(0, 0, 841.89, 1190.55);
break;
case 'A4':
default:
$size = array(0, 0, 595.28, 841.89);
break;
case 'A5':
$size = array(0, 0, 419.53, 595.28);
break;
case 'A6':
$size = array(0, 0, 297.64, 419.53);
break;
case 'A7':
$size = array(0, 0, 209.76, 297.64);
break;
case 'A8':
$size = array(0, 0, 147.4, 209.76);
break;
case 'A9':
$size = array(0, 0, 104.88, 147.4);
break;
case 'A10':
$size = array(0, 0, 73.7, 104.88);
break;
case 'B0':
$size = array(0, 0, 2834.65, 4008.19);
break;
case 'B1':
$size = array(0, 0, 2004.09, 2834.65);
break;
case 'B2':
$size = array(0, 0, 1417.32, 2004.09);
break;
case 'B3':
$size = array(0, 0, 1000.63, 1417.32);
break;
case 'B4':
$size = array(0, 0, 708.66, 1000.63);
break;
case 'B5':
$size = array(0, 0, 498.9, 708.66);
break;
case 'B6':
$size = array(0, 0, 354.33, 498.9);
break;
case 'B7':
$size = array(0, 0, 249.45, 354.33);
break;
case 'B8':
$size = array(0, 0, 175.75, 249.45);
break;
case 'B9':
$size = array(0, 0, 124.72, 175.75);
break;
case 'B10':
$size = array(0, 0, 87.87, 124.72);
break;
case 'C0':
$size = array(0, 0, 2599.37, 3676.54);
break;
case 'C1':
$size = array(0, 0, 1836.85, 2599.37);
break;
case 'C2':
$size = array(0, 0, 1298.27, 1836.85);
break;
case 'C3':
//.........这里部分代码省略.........