Open corvinsoft-tothzs opened 4 years ago
Try the 2015 version instead of the 2007 one first: https://wwwimages2.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/AcrobatDC_js_api_reference.pdf
Also, where is the "cr" declaration in the linked doc? Searching for it reveals nothing.
Thanks for answer!
My doc: 443page, Ur doc: 439 page
I tried: style.cr too, but not working.
Thanks. As far as I understand that, style.cr
is not a string, it is a reference to style
's object variable, so try the actual Style names: e.g. "cross" or "diamond" instead.
I'm also unsure if TCPDF actually supports this, look at this is the code by the way (the file seems too large for Github to index), the cr
key doesn't seem to be used:
/**
* Creates a CheckBox field
* @param $name (string) field name
* @param $w (int) width
* @param $checked (boolean) define the initial state.
* @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 $onvalue (string) value to be returned if selected.
* @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 CheckBox($name, $w, $checked=false, $prop=array(), $opt=array(), $onvalue='Yes', $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($w, $x, $y);
if ($js) {
$this->_addfield('checkbox', $name, $x, $y, $w, $w, $prop);
return;
}
if (!isset($prop['value'])) {
$prop['value'] = array('Yes');
}
// get default style
$prop = array_merge($this->getFormDefaultProp(), $prop);
$prop['borderStyle'] = 'inset';
// get annotation data
$popt = TCPDF_STATIC::getAnnotOptFromJSProp($prop, $this->spot_colors, $this->rtl);
// set additional default options
$font = 'zapfdingbats';
if ($this->pdfa_mode) {
// all fonts must be embedded
$font = 'pdfa'.$font;
}
$this->AddFont($font);
$tmpfont = $this->getFontBuffer($font);
$this->annotation_fonts[$tmpfont['fontkey']] = $tmpfont['i'];
$fontstyle = sprintf('/F%d %F Tf %s', $tmpfont['i'], $this->FontSizePt, $this->TextColor);
$popt['da'] = $fontstyle;
// build appearance stream
$popt['ap'] = array();
$popt['ap']['n'] = array();
$fx = ((($w - $this->getAbsFontMeasure($tmpfont['cw'][110])) / 2) * $this->k);
$fy = (($w - ((($tmpfont['desc']['Ascent'] - $tmpfont['desc']['Descent']) * $this->FontSizePt / 1000) / $this->k)) * $this->k);
$popt['ap']['n']['Yes'] = sprintf('q %s BT /F%d %F Tf %F %F Td ('.chr(110).') Tj ET Q', $this->TextColor, $tmpfont['i'], $this->FontSizePt, $fx, $fy);
$popt['ap']['n']['Off'] = sprintf('q %s BT /F%d %F Tf %F %F Td ('.chr(111).') Tj ET Q', $this->TextColor, $tmpfont['i'], $this->FontSizePt, $fx, $fy);
// merge options
$opt = array_merge($popt, $opt);
// set remaining annotation data
$opt['Subtype'] = 'Widget';
$opt['ft'] = 'Btn';
$opt['t'] = $name;
if (TCPDF_STATIC::empty_string($onvalue)) {
$onvalue = 'Yes';
}
$opt['opt'] = array($onvalue);
if ($checked) {
$opt['v'] = array('/Yes');
$opt['as'] = 'Yes';
} else {
$opt['v'] = array('/Off');
$opt['as'] = 'Off';
}
$this->Annotation($x, $y, $w, $w, $name, $opt, 0);
if ($this->rtl) {
$this->x -= $w;
} else {
$this->x += $w;
}
}
Hi!
I want generate checkbox with pipe style, but not working.
i read: https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/js_api_reference.pdf
my code:
Am I spoiling something or seriously not working?