downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

fdf_set_opt> <fdf_set_javascript_action
[edit] Last updated: Fri, 26 Apr 2013

view this page in

fdf_set_on_import_javascript

(PHP 4 >= 4.3.0, PHP 5)

fdf_set_on_import_javascriptAdds javascript code to be executed when Acrobat opens the FDF

Description

bool fdf_set_on_import_javascript ( resource $fdf_document , string $script , bool $before_data_import )
Warning

This function is currently not documented; only its argument list is available.

See Also



add a note add a note User Contributed Notes fdf_set_on_import_javascript - [1 notes]
up
0
Jake Marble
5 years ago
This example would cause a browser to open 'a.pdf' and pop up an alert window AFTER setting a field value:

<?php
header
('Content-type: application/vnd.fdf');

$fdf = fdf_create();

fdf_set_file($fdf, 'http://www.example.com/path/to/a.pdf');
fdf_set_value($fdf, 'field1', 'my value');
fdf_set_on_import_javascript($fdf, 'app.alert("executing javascript");', false);

fdf_save($fdf);
fdf_close($fdf);
?>

Or, to execute the javascript BEFORE setting the field value, just change false to true:

<?php
header
('Content-type: application/vnd.fdf');

$fdf = fdf_create();

fdf_set_file($fdf, 'http://www.example.com/path/to/a.pdf');
fdf_set_value($fdf, 'field1', 'my value');
fdf_set_on_import_javascript($fdf, 'app.alert("executing javascript");', true);

fdf_save($fdf);
fdf_close($fdf);
?>

 
show source | credits | stats | sitemap | contact | advertising | mirror sites