在我的 LOCALHOST 上,我有一个创建 FDF 文件的表单......还在该文件中它包含一个“完整路径”->“ http://localhost/example/example.pdf ”......所以当我“单击链接”在浏览器中打开 FDF 文件,它会加载 PDF,并在适当的位置插入 FDF 数据。
当我在我的 Linux 服务器(非本地)上执行此操作时,当我单击 FDF 文件打开它时,它只是打开文件,并将文本(fdf 文件)呈现到屏幕上,而不是“打开”fdf 文件。
想知道是否有人可以帮助我完成此过程...我想打开 FDF 文件,因此它也打开了 PDF 文件。
这是我已经完成的一些代码,但我已经注释掉了“标题”......因为我认为在“打开”文件时不需要标题,而不是在屏幕上呈现一个?
$fdf = new fdf();
//$response = $fdf->fdfMerge(APP_ROOT."/forms/test/FormTest.pdf", $_POST);
$response = $fdf->renderFDF(DOMAIN."forms/test/FormTest.pdf", $_POST, $_POST['userId'], $_POST['contactId']);
//var_dump($response);
// Link DIRECTLY to the FDF file...
echo "Internal: <a href='". $response['internalPath'] ."'>". $response['internalPath'] ."</a><br />";
echo "External: <a href='". $response['externalPath'] ."'>". $response['externalPath'] ."</a><br />";
/*
if(ini_get('zlib.output_compression'))
ini_set('zlib.output_compression', 'Off');
header("Pragma: public"); // required
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private", false); // required for certain browsers
header("Content-Type: application/x-download");
header("Content-Disposition: attachment; filename=".$response['fdfFile'].";" );
header("Content-Length: ".$filesize($response['fdfFile'])."");
header("Content-Transfer-Encoding: binary");
ob_clean();
flush();
fopen($response['fullPath']);
*/
--- 来自 LINUX BOX 的浏览器响应 ---
%FDF-1.2
%âãÃÓ
1 0 obj
<<
/FDF << /Fields [ <</T(formId)/V(111)>><</T(userId)/V(23)>><</T(contactId)/V(2950)>><</T(firstName)/V(Justin)>><</T(lastName)/V(Geezer)>><</T(email)/V(justin@stickypages.ca)>>]
/F (https://www.example.com/forms/test/FormTest.pdf) /ID [ <bd71513804f75900e899f3be924b69ef>
] >>
>>
endobj
trailer
<<
/Root 1 0 R
>>
%%EOF
这是一个屏幕截图,当我使用“HEADER”响应时。
编辑:如果我从服务器下载 FDF 文件,然后“双击”打开文件,它会从网上下载 PDF 文件并打开它。