略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: fdf_set_on_import_javascript

2024-12-21

fdf_set_on_import_javascript

(PHP 4 >= 4.3.0, PHP 5 < 5.3.0, PECL fdf SVN)

fdf_set_on_import_javascriptAdds javascript code to be executed when Acrobat opens the FDF

说明

fdf_set_on_import_javascript(resource $fdf_document, string $script, bool $before_data_import): bool
警告

本函数还未编写文档,仅有参数列表。

参见

add a noteadd a note

User Contributed Notes 1 note

up
1
Jake Marble
14 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);
?>

官方地址:https://www.php.net/manual/en/function.fdf-set-on-import-javascript.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3