The doc says that an empty file name will cause PHP to output the FDF to 'stdout'. I had no success on this (with PHP 4.2.3 and fdftk v5): no string, an empty string and null all returned a message complaining about 'wrong parameter count'.
So I used the way (saving to a file and using passthru) given as an example on the page describing fdf_create(), and added a uniqid(rand(),1) to the filename to avoid clashes. This worked well.
fdf_save
(PHP 4, PHP 5)
fdf_save — Save a FDF document
说明
bool fdf_save
( resource
$fdf_document
[, string $filename
] )Saves a FDF document.
参数
-
fdf_document -
The FDF document handle, returned by fdf_create(), fdf_open() or fdf_open_string().
-
filename -
If provided, the resulting FDF will be written in this parameter. Otherwise, this function will write the FDF to the default PHP output stream.
返回值
成功时返回 TRUE, 或者在失败时返回 FALSE。
参见
- fdf_close() - Close an FDF document
- fdf_create() - Create a new FDF document
- fdf_save_string() - Returns the FDF document as a string
karsten at k-fish dot de ¶
10 years ago
