本文整理汇总了PHP中Cezpdf::Rectangle方法的典型用法代码示例。如果您正苦于以下问题:PHP Cezpdf::Rectangle方法的具体用法?PHP Cezpdf::Rectangle怎么用?PHP Cezpdf::Rectangle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cezpdf
的用法示例。
在下文中一共展示了Cezpdf::Rectangle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$cools = array('à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ð', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', '÷', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'þ', 'ÿ', 'ß', '\'', ' ', 'à', 'á', 'ã', 'ä', 'å', 'è', 'æ', 'ê', 'ë', 'ì', 'í', 'î', 'Î', 'ï', 'ò', 'ó', 'ô', 'õ', 'ö', 'ø', 'ù', 'ú', 'û', 'ü', 'ñ', 'ç', 'ý', '<', '>', '&', 'é');
$currencies = new currencies();
//$pdf->setPreferences(array("HideToolbar" => 'false', "HideWindowUI" => 'false'));
$pdf->selectFont(BATCH_PDF_DIR . 'Helvetica.afm');
$pdf->setFontFamily(BATCH_PDF_DIR . 'Helvetica.afm');
// logo image
list($w, $h) = getimagesize(HTTP_CATALOG_SERVER . DIR_WS_CATALOG . 'templates/' . DIR_WS_TEMPLATES_DEFAULT . '/images/' . STORE_LOGO);
if (stristr(STORE_LOGO, '.png') === FALSE) {
$pdf->addJpegFromFile(HTTP_CATALOG_SERVER . DIR_WS_CATALOG . 'templates/' . DIR_WS_TEMPLATES_DEFAULT . '/images/' . STORE_LOGO, 30, 730, $w, $h);
} else {
$pdf->addPngFromFile(HTTP_CATALOG_SERVER . DIR_WS_CATALOG . 'templates/' . DIR_WS_TEMPLATES_DEFAULT . '/images/' . STORE_LOGO, 30, 730, $w, $h);
}
// invoice number and box
$pdf->setStrokeColor(0, 0, 0);
$pdf->setLineStyle(0.5);
$pdf->Rectangle(390, 793, 175, 20);
$y = $pdf->ezText("<b>" . str_replace($vilains, $cools, TEXT_ORDER_NUMBER) . " </b>" . $orders['orders_prefix'] . $orders['orders_id'] . "\n\n", SUB_HEADING_FONT_SIZE, array('aleft' => '400'));
// company name and details pulled from the my store address and phone number
// in admin configuration mystore
$y += 10;
$y = $pdf->ezText(STORE_NAME_ADDRESS, COMPANY_HEADER_FONT_SIZE, array('aleft' => '400'));
$y -= 10;
// Add in the order titles
$totalsy = 230;
$pdf->ezSetY($totalsy);
for ($j = 0, $n = sizeof($order->totals); $j < $n; $j++) {
$totaltext = str_replace($vilains, $cools, $order->totals[$j]['title']);
$fullstop = stripos($totaltext, ".");
// Cuts shipping title at first '.' and replaces with :
if ($fullstop != '0') {
$totaltext = substr($totaltext, 0, $fullstop);
示例2: array
$vilains = array("à", "á", "â", "ã", "ä", "å", "æ", "ç", "è", "é", "ê", "ë", "ì", "í", "î", "ï", "ð", "ñ", "ò", "ó", "ô", "õ", "ö", "÷", "ø", "ù", "ú", "û", "ü", "ý", "þ", "ÿ", "ß", "'", " ", "à", "á", "ã", "ä", "&Arond;", "è", "æ", "ê", "ë", "ì", "í", "Í", "î", "ï", "ò", "ó", "ô", "õ", "ö", "ø", "ù", "ú", "û", "ü", "ñ", "ç", "ý", "<", ">", "&");
$cools = array('à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ð', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', '÷', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'þ', 'ÿ', 'ß', '\'', ' ', 'à', 'á', 'ã', 'ä', 'å', 'è', 'æ', 'ê', 'ë', 'ì', 'í', 'î', 'Î', 'ï', 'ò', 'ó', 'ô', 'õ', 'ö', 'ø', 'ù', 'ú', 'û', 'ü', 'ñ', 'ç', 'ý', '<', '>', '&');
$currencies = new currencies();
//$pdf->setPreferences(array("HideToolbar" => 'false', "HideWindowUI" => 'false'));
$pdf->selectFont(BATCH_PDF_DIR . 'Helvetica.afm');
$pdf->setFontFamily(BATCH_PDF_DIR . 'Helvetica.afm');
// company name and details pulled from the my store address and phone number
// in admin configuration mystore
$y = $pdf->ezText(STORE_NAME_ADDRESS, COMPANY_HEADER_FONT_SIZE);
$y -= 10;
// logo image set to right of the above .. change first number to move sideways
//$pdf->addJpegFromFile(BATCH_PRINT_INC . 'templates/' . 'invoicelogo.jpg',365,730,85,85);
// extra info boxs to be used by staff
$pdf->setStrokeColor(0, 0, 0);
$pdf->setLineStyle(0.5);
$pdf->Rectangle(300, 745, 250, 70);
$pdf->addText(310, 785, GENERAL_FONT_SIZE, TEXT_PACKED_BY);
$pdf->addText(310, 760, GENERAL_FONT_SIZE, TEXT_VERIFIED_BY);
// line between header order number and order date
$pdf->setLineStyle(0.5);
$pdf->line(LEFT_MARGIN, $y, LINE_LENGTH, $y);
$pdf->ezSetY($y);
$dup_y = $y;
// order number
$y = $pdf->ezText("<b>" . TEXT_ORDER_NUMBER . " </b>" . $orders['orders_prefix'] . $orders['orders_id'] . "\n\n", SUB_HEADING_FONT_SIZE);
// order date
if ($_POST['show_order_date']) {
$pdf->ezSetY($dup_y);
$pdf->ezText("<b>" . TEXT_ORDER_DATE . " </b>" . date(TEXT_ORDER_FORMAT, strtotime($order->info['date_purchased'])) . "\n\n", SUB_HEADING_FONT_SIZE, array('justification' => 'right'));
}
// sold to info in left rectangle
示例3: printPDF
//.........这里部分代码省略.........
}
} else {
// TODO : erreur ?
// print_r($p_params);
return 0;
}
}
// create pdf
// x is horizontal axis and y is vertical
// x=0 and y=0 in bottom left hand corner
$config = $pbConfig->getConfigType($type);
require_once GLPI_ROOT . "/plugins/barcode/lib/ezpdf/class.ezpdf.php";
$pdf = new Cezpdf($size, $orientation);
$pdf->selectFont(GLPI_ROOT . "/plugins/barcode/lib/ezpdf/fonts/Helvetica.afm");
$pdf->ezStartPageNumbers($pdf->ez['pageWidth'] - 30, 10, 10, 'left', '{PAGENUM} / {TOTALPAGENUM}') . ($width = $config['maxCodeWidth']);
$height = $config['maxCodeHeight'];
$marginH = $config['marginHorizontal'];
$marginV = $config['marginVertical'];
$heightimage = $height;
if (file_exists(GLPI_PLUGIN_DOC_DIR . '/barcode/logo.png')) {
// Add logo to barcode
$heightLogomax = 20;
$imgSize = getimagesize(GLPI_PLUGIN_DOC_DIR . '/barcode/logo.png');
$logoWidth = $imgSize[0];
$logoHeight = $imgSize[1];
if ($logoHeight > $heightLogomax) {
$ratio = 100 * $heightLogomax / $logoHeight;
$logoHeight = $heightLogomax;
$logoWidth = $logoWidth * ($ratio / 100);
}
if ($logoWidth > $width) {
$ratio = 100 * $width / $logoWidth;
$logoWidth = $width;
$logoHeight = $logoHeight * ($ratio / 100);
}
$heightyposText = $height - $logoHeight;
$heightimage = $heightyposText;
}
$first = true;
foreach ($codes as $code) {
if ($first) {
$x = $pdf->ez['leftMargin'];
$y = $pdf->ez['pageHeight'] - $pdf->ez['topMargin'] - $height;
$first = false;
} else {
if ($x + $width + $marginH > $pdf->ez['pageWidth']) {
// new line
$x = $pdf->ez['leftMargin'];
if ($y - $height - $marginV < $pdf->ez['bottomMargin']) {
// new page
$pdf->ezNewPage();
$y = $pdf->ez['pageHeight'] - $pdf->ez['topMargin'] - $height;
} else {
$y -= $height + $marginV;
}
}
}
if ($code != '') {
if ($type == 'QRcode') {
$imgFile = $code;
} else {
$imgFile = $this->docsPath . $code . '_' . $type . '.' . $ext;
}
if (file_exists($imgFile)) {
$imgSize = getimagesize($imgFile);
$imgWidth = $imgSize[0];
$imgHeight = $imgSize[1];
if ($imgWidth > $width) {
$ratio = 100 * $width / $imgWidth;
$imgWidth = $width;
$imgHeight = $imgHeight * ($ratio / 100);
}
if ($imgHeight > $heightimage) {
$ratio = 100 * $heightimage / $imgHeight;
$imgHeight = $heightimage;
$imgWidth = $imgWidth * ($ratio / 100);
}
$image = imagecreatefrompng($imgFile);
if ($imgWidth < $width) {
$pdf->addImage($image, $x + ($width - $imgWidth) / 2, $y, $imgWidth, $imgHeight);
} else {
$pdf->addImage($image, $x, $y, $imgWidth, $imgHeight);
}
if (file_exists(GLPI_PLUGIN_DOC_DIR . '/barcode/logo.png')) {
$logoimg = imagecreatefrompng(GLPI_PLUGIN_DOC_DIR . '/barcode/logo.png');
$pdf->addImage($logoimg, $x + ($width - $logoWidth) / 2, $y + $heightyposText, $logoWidth, $logoHeight);
}
if ($p_params['border']) {
$pdf->Rectangle($x, $y, $width, $height);
}
}
}
$x += $width + $marginH;
$y -= 0;
}
$file = $pdf->ezOutput();
$pdfFile = $_SESSION['glpiID'] . '_' . $type . '.pdf';
file_put_contents($this->docsPath . $pdfFile, $file);
return '/files/_plugins/barcode/' . $pdfFile;
}