Moj kod je sljedeci:
<?php
set_time_limit(180);
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);
}
header('Content-type: application/pdf');
header('Content-Disposition: filename=cert.pdf');
$date = date('F d, Y');
$filename = 'sablon.pdf';
$fp = fopen($filename, 'r');
$output = fread($fp, filesize($filename));
fclose($fp);
$output = pdf_replace('Ono-sto-trazim', 'izmijenjeno', $output);
echo $output;
?>
Izbaci mi error:
There was an error opening this document. The file is damaged and could not be repaired.