在我的本地,我有一个创建和FDF文件......此外,在该文件它包括一个“完整路径”形式 - >“http://localhost/example/example.pdf” ......所以当我点击链接“在浏览器中打开FDF文件时,它会加载插入到正确位置的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盒---
%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([email protected])>>]
/F (https://www.example.com/forms/test/FormTest.pdf) /ID [ <bd71513804f75900e899f3be924b69ef>
] >>
>>
endobj
trailer
<<
/Root 1 0 R
>>
%%EOF
下面是截图,当我用 “头” 的响应。
编辑:如果我从服务器下载的FDF文件,以及“双击”,打开文件时,它会从网上下载的PDF文件,并打开它的罚款。
听起来像一个头的问题,您能不能告诉你的代码? – JamesHalsall
@Jaitsu,我已经添加了一个代码示例... – Justin
你的本地主机上运行什么? Mac,Windows,Linux?什么版本的PHP在你的本地主机和你的Linux机器上? – JamesHalsall