By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,665 Members | 1,900 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,665 IT Pros & Developers. It's quick & easy.

Illegal Characters in FDF File - Stream

P: n/a
Hi all,

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";


$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.

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 >>
@xJ_S$`(5a&.NL Uap.P5sQJ
ȵw5G&oxzdV[4G6G&oxzdvG&oxzdzecb<1&B+ S


Posted via a free Usenet account from

Jun 13 '07 #1
Share this Question
Share on Google+
3 Replies

P: n/a
Unless someone has a better idea - as I think this object in the tool
kit is broken - I think I will just save the fdf out and then snip the
last few lines off and add my own stream containing the js and then
close out the fdf manually like so...

10 0 obj
<< /Filter [ /FlateDecode ] /Length 107 >>

function run_onload__(){\r 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 }\r
/Root 1 0 R

Jun 14 '07 #2

P: n/a
Anyone out there actually use the FDF tool kit?

Jun 15 '07 #3

P: n/a
On Jun 15, 10:43 am, jh <jon.harr...@gmail.comwrote:
Anyone out there actually use theFDFtool kit?
Guess not.

I reworked the code and it seems to work now.

Jun 18 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.