I have been working on a php script lately that merges results from a db
and an xml source and then populates a PDF through FDF. I have gotten
nearly everything to work except multi line javascript. I have tried
both of the following attacks on the problem to no avail.
First I tried setting the set_on_import directly... then I tried to set
all the javascript in a function and then call the function on load...
both of them generate illegal characters in the stream.
Both of these examples are in a for each that contain a $counter:
$js = 'this.getField("moveinready.' . $counter . '").display =
display.visible;' . "\r";
$js .= 'this.getField("moveinready.' . $counter . '").display =
display.visible;' . "\r";
fdf_set_on_import_javascript($fdf,$js,true)
and
$js = "function run_onload_()\r{\r"; $js .=
'this.getField("moveinready.' . $counter . '").display =
display.visible;' . "\r";
$js .= 'this.getField("moveinready.' . $counter . '").display =
display.visible;' . "\r";
$js .= "\r}\r"; fdf_add_doc_javascript($fdf,"run_onload_", $js);
fdf_set_on_import_javascript($fdf,"run_onload_();" ,true)
both methods die if I use a string like this for $js:
this.getField("move.1").display = display.hidden;\r
this.getField("bullet.1").display = display.visible;\r
this.getField("move.2").display = display.hidden;\r
this.getField("bullet.2").display = display.hidden;\r
this.getField("move.3").display = display.hidden;\r
this.getField("bullet.3").display = display.hidden;\r
this.getField("move.4").display = display.hidden;\r
this.getField("bullet.4").display = display.hidden;\r
both work fine if I limit the string to 1 line like this:
fdf_set_on_import_javascript($fdf , 'this.getField("move.1").display =
display.hidden;' , true);
The fdf contains a stream of illegal characters when using a multi line
string. However I cannot simply use a single instruction as the fdf
seems to only want 1 on_import_js to a file.
any help would be great as this toolkit lacks documentation for php.
-jh
-------------------------------------
example of fdf output stream - supposed to be readable javascript here:
<<
/FDF << /Fields 2 0 R /JavaScript << /Before 10 0 R >>
10 0 obj>>
<< /Filter [ /FlateDecode ] /Length 176 >>
stream
H=
@xJ_S$`(5a&.NL Uap.P5sQJ
ȵw5G&oxzdV[4G6G&oxzdvG&oxzdzecb<1&B+ S
endstream
endobj
--
Posted via a free Usenet account from http://www.teranews.com