我試圖創建一個.PDF自動,但由於某種原因。由於PDF_REPLACE()語法,PDF無法創建。
所以這個腳本作品完美,只要我不觸發:
$output = pdf_replace("<<<opmerking>>>", $datum, $output);
網上代碼是在這裏: http://073design.nl/peter/index_process.php
(在第一種情況下,我錯過了功能,但現在我definied功能和接收還是同樣的錯誤在pdf_replace。)
<?php
$naam = 'Jan Janssen';
$datum = 'test';
//function define
function pdf_replace($pattern, $replacement, $string) {
$len = strlen($pattern);
$regexp = '';
for($i = 0 ; $i<$len ; $i++) {
$regexp .= $pattern[$i];
if($i<$len-1) {
$regexp .= "(\)\-{0,1} [0-9]*\(){0,1}";
}
}
return ereg_replace($regexp, $replacement, $string);
}
//Generate the headers to let a browser choose correct application
header('Content-Disposition: filename=dagstaat.pdf');
header('Content-type: application/pdf');
//open template
$filename = 'dagstaat.pdf';
$fp = fopen($filename, 'r');
$output = fread($fp, filesize($filename));
fclose($fp);
//replace the place holders in the template
$output = pdf_replace("<<<opmerking>>>", $datum, $output); // PROBLEM IS HERE
echo $output;
?>
到底是什麼錯誤? – Kyle
使用此服務http://phptopdf.com/這是非常容易使用 – Thamaraiselvam
@ KP:只需點擊http://073design.nl/peter/index_process.php你會看到錯誤 –