本文整理汇总了PHP中TCPDF_STATIC::getAnnotOptFromJSProp方法的典型用法代码示例。如果您正苦于以下问题:PHP TCPDF_STATIC::getAnnotOptFromJSProp方法的具体用法?PHP TCPDF_STATIC::getAnnotOptFromJSProp怎么用?PHP TCPDF_STATIC::getAnnotOptFromJSProp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCPDF_STATIC
的用法示例。
在下文中一共展示了TCPDF_STATIC::getAnnotOptFromJSProp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Button
/**
* Creates a button field
* @param $name (string) field name
* @param $w (int) width
* @param $h (int) height
* @param $caption (string) caption.
* @param $action (mixed) action triggered by pressing the button. Use a string to specify a javascript action. Use an array to specify a form action options as on section 12.7.5 of PDF32000_2008.
* @param $prop (array) javascript field properties. Possible values are described on official Javascript for Acrobat API reference.
* @param $opt (array) annotation parameters. Possible values are described on official PDF32000_2008 reference.
* @param $x (float) Abscissa of the upper-left corner of the rectangle
* @param $y (float) Ordinate of the upper-left corner of the rectangle
* @param $js (boolean) if true put the field using JavaScript (requires Acrobat Writer to be rendered).
* @public
* @author Nicola Asuni
* @since 4.8.000 (2009-09-07)
*/
public function Button($name, $w, $h, $caption, $action, $prop = array(), $opt = array(), $x = '', $y = '', $js = false)
{
if ($x === '') {
$x = $this->x;
}
if ($y === '') {
$y = $this->y;
}
// check page for no-write regions and adapt page margins if necessary
list($x, $y) = $this->checkPageRegions($h, $x, $y);
if ($js) {
$this->_addfield('button', $name, $this->x, $this->y, $w, $h, $prop);
$this->javascript .= 'f' . $name . ".buttonSetCaption('" . addslashes($caption) . "');\n";
$this->javascript .= 'f' . $name . ".setAction('MouseUp','" . addslashes($action) . "');\n";
$this->javascript .= 'f' . $name . ".highlight='push';\n";
$this->javascript .= 'f' . $name . ".print=false;\n";
return;
}
// get default style
$prop = array_merge($this->getFormDefaultProp(), $prop);
$prop['Pushbutton'] = 'true';
$prop['highlight'] = 'push';
$prop['display'] = 'display.noPrint';
// get annotation data
$popt = TCPDF_STATIC::getAnnotOptFromJSProp($prop, $this->spot_colors, $this->rtl);
$this->annotation_fonts[$this->CurrentFont['fontkey']] = $this->CurrentFont['i'];
$fontstyle = sprintf('/F%d %F Tf %s', $this->CurrentFont['i'], $this->FontSizePt, $this->TextColor);
$popt['da'] = $fontstyle;
// build appearance stream
$popt['ap'] = array();
$popt['ap']['n'] = '/Tx BMC q ' . $fontstyle . ' ';
$tmpid = $this->startTemplate($w, $h, false);
$bw = 2 / $this->k;
// border width
$border = array('L' => array('width' => $bw, 'cap' => 'square', 'join' => 'miter', 'dash' => 0, 'color' => array(231)), 'R' => array('width' => $bw, 'cap' => 'square', 'join' => 'miter', 'dash' => 0, 'color' => array(51)), 'T' => array('width' => $bw, 'cap' => 'square', 'join' => 'miter', 'dash' => 0, 'color' => array(231)), 'B' => array('width' => $bw, 'cap' => 'square', 'join' => 'miter', 'dash' => 0, 'color' => array(51)));
$this->SetFillColor(204);
$this->Cell($w, $h, $caption, $border, 0, 'C', true, '', 1, false, 'T', 'M');
$this->endTemplate();
--$this->n;
$popt['ap']['n'] .= $this->xobjects[$tmpid]['outdata'];
unset($this->xobjects[$tmpid]);
$popt['ap']['n'] .= 'Q EMC';
// set additional default options
if (!isset($popt['mk'])) {
$popt['mk'] = array();
}
$ann_obj_id = $this->n + 1;
if (!empty($action) and !is_array($action)) {
$ann_obj_id = $this->n + 2;
}
$popt['mk']['ca'] = $this->_textstring($caption, $ann_obj_id);
$popt['mk']['rc'] = $this->_textstring($caption, $ann_obj_id);
$popt['mk']['ac'] = $this->_textstring($caption, $ann_obj_id);
// merge options
$opt = array_merge($popt, $opt);
// set remaining annotation data
$opt['Subtype'] = 'Widget';
$opt['ft'] = 'Btn';
$opt['t'] = $caption;
$opt['v'] = $name;
if (!empty($action)) {
if (is_array($action)) {
// form action options as on section 12.7.5 of PDF32000_2008.
$opt['aa'] = '/D <<';
$bmode = array('SubmitForm', 'ResetForm', 'ImportData');
foreach ($action as $key => $val) {
if ($key == 'S' and in_array($val, $bmode)) {
$opt['aa'] .= ' /S /' . $val;
} elseif ($key == 'F' and !empty($val)) {
$opt['aa'] .= ' /F ' . $this->_datastring($val, $ann_obj_id);
} elseif ($key == 'Fields' and is_array($val) and !empty($val)) {
$opt['aa'] .= ' /Fields [';
foreach ($val as $field) {
$opt['aa'] .= ' ' . $this->_textstring($field, $ann_obj_id);
}
$opt['aa'] .= ']';
} elseif ($key == 'Flags') {
$ff = 0;
if (is_array($val)) {
foreach ($val as $flag) {
switch ($flag) {
case 'Include/Exclude':
$ff += 1 << 0;
break;
//.........这里部分代码省略.........