本文整理汇总了PHP中Cezpdf::partEllipse方法的典型用法代码示例。如果您正苦于以下问题:PHP Cezpdf::partEllipse方法的具体用法?PHP Cezpdf::partEllipse怎么用?PHP Cezpdf::partEllipse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cezpdf
的用法示例。
在下文中一共展示了Cezpdf::partEllipse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Documento
public static function Documento($id_documento, $preview = FALSE, $params = NULL)
{
$dbase = DocumentoBaseDAO::getByPK($id_documento);
$dbase->setJsonImpresion(str_replace("\\n", "", $dbase->getJsonImpresion()));
$dbase->setJsonImpresion(str_replace("\\t", "", $dbase->getJsonImpresion()));
$dbase->setJsonImpresion(stripslashes($dbase->getJsonImpresion()));
if ("\"" == substr($dbase->getJsonImpresion(), 0, 1)) {
$dbase->setJsonImpresion(substr($dbase->getJsonImpresion(), 1, -1));
}
$decoded_json = json_decode($dbase->getJsonImpresion());
#echo $dbase->getJsonImpresion(); die;
if (is_null($decoded_json)) {
throw new InvalidDataException("json invalido");
}
$pdf = new Cezpdf(array(0, 0, $decoded_json->width, $decoded_json->height));
if (is_file(POS_PATH_TO_SERVER_ROOT . "libs/ezpdf/fonts/Helvetica.afm")) {
$pdf->selectFont(POS_PATH_TO_SERVER_ROOT . "libs/ezpdf/fonts/Helvetica.afm");
} else {
throw new Exception();
}
for ($i = 0; $i < sizeof($decoded_json->body); $i++) {
switch ($decoded_json->body[$i]->type) {
case "text":
if (!$preview) {
while (($posI = strpos($decoded_json->body[$i]->value, "{")) !== FALSE) {
$posF = strpos($decoded_json->body[$i]->value, "}");
$key = substr($decoded_json->body[$i]->value, $posI + 1, $posF - $posI - 1);
if (TRUE === array_key_exists($key, $params)) {
$decoded_json->body[$i]->value = substr_replace($decoded_json->body[$i]->value, $params[$key], $posI, $posF - $posI + 1);
} else {
$decoded_json->body[$i]->value = substr_replace($decoded_json->body[$i]->value, "", $posI, $posF - $posI + 1);
}
}
}
$pdf->addText($decoded_json->body[$i]->x, $decoded_json->body[$i]->y, $decoded_json->body[$i]->fontSize, utf8_decode($decoded_json->body[$i]->value));
break;
case "round-box":
$x = $decoded_json->body[$i]->x;
$y = $decoded_json->body[$i]->y;
$w = $decoded_json->body[$i]->w;
$h = $decoded_json->body[$i]->h;
$pdf->setStrokeColor(0.3359375, 0.578125, 0.89453125);
$pdf->setLineStyle(1);
$pdf->line($x + 2, $y, $x + $w - 2, $y);
//arriba
$pdf->line($x, $y - 2, $x, $y - $h + 2);
//izquierda
$pdf->line($x + 2, $y - $h, $x + $w - 2, $y - $h);
//abajo
$pdf->line($x + $w, $y - 2, $x + $w, $y - $h + 2);
//derecha
$pdf->partEllipse($x + 3, $y - 3, 90, 180, 3);
//top-left
$pdf->partEllipse($x + $w - 3, $y - 3, 0, 90, 3);
//top-right
$pdf->partEllipse($x + $w - 3, $y - $h + 3, 360, 240, 3);
//bottom-right
$pdf->partEllipse($x + 3, $y - $h + 3, 180, 270, 3);
//bottom-left
break;
}
}
//margenes de un centimetro para toda la pagina
$pdf->ezSetMargins($decoded_json->marginTop, $decoded_json->marginBottom, $decoded_json->marginLeft, $decoded_json->marginRight);
/**************************
* ENCABEZADO
***************************/
//$pdf->addText( self::puntos_cm(7.1), self::puntos_cm(26.1), 18, utf8_decode($title));
//$pdf->addText( self::puntos_cm(7.1), self::puntos_cm(25.5), 12, utf8_decode($subtitle));
$pdf->ezStream();
exit;
}