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( "moveinread y.' . $counter . '").display =
display.visible ;' . "\r";
$js .= 'this.getField( "moveinread y.' . $counter . '").display =
display.visible ;' . "\r";
fdf_set_on_impo rt_javascript($ fdf,$js,true)
and
$js = "function run_onload_()\r {\r"; $js .=
'this.getField( "moveinread y.' . $counter . '").display =
display.visible ;' . "\r";
$js .= 'this.getField( "moveinread y.' . $counter . '").display =
display.visible ;' . "\r";
$js .= "\r}\r"; fdf_add_doc_jav ascript($fdf,"r un_onload_", $js);
fdf_set_on_impo rt_javascript($ fdf,"run_onload _();",true)
both methods die if I use a string like this for $js:
this.getField(" move.1").displa y = display.hidden; \r
this.getField(" bullet.1").disp lay = display.visible ;\r
this.getField(" move.2").displa y = display.hidden; \r
this.getField(" bullet.2").disp lay = display.hidden; \r
this.getField(" move.3").displa y = display.hidden; \r
this.getField(" bullet.3").disp lay = display.hidden; \r
this.getField(" move.4").displa y = display.hidden; \r
this.getField(" bullet.4").disp lay = display.hidden; \r
both work fine if I limit the string to 1 line like this:
fdf_set_on_impo rt_javascript($ fdf , 'this.getField( "move.1").displ ay =
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$`(5 a& .NLUap .P5 sQJ
ȵw5G&ox zdV[4G6G&o xzdvG&oxzd zecb<1 &B+S
endstream
endobj
--
Posted via a free Usenet account from http://www.teranews.com