No tak tu si môžeš prezrieť nejaké veci čo som k tomu našiel: http://www.stud.fit.vutbr.cz/~xbelic02/ITU/TODO29.php
Ja som používal Zoho Viewer lebo dával najlepšie výsledky. Dám sem kus kódu čo mi asi fungoval.
class PDFExtracter {
const URL_OF_ONLINE_CONVERTER = 'http://viewer.zoho.com/api/urlview.do';
const URF_OF_CONVERTED_CONTENT = 'http://viewer.zoho.com/gettempcontent.do';
static function getPDFContent($fileURL) {
$queryString = '?url=' . urlencode($fileURL) . '&embed=true';
$content = file_get_contents(
PDFExtracter::URL_OF_ONLINE_CONVERTER . $queryString
);
//echo PDFExtracter::URL_OF_ONLINE_CONVERTER . $queryString.'<br />';
if($content === false) { return false; }
$matchCount = preg_match(
'#http://viewer\.zoho\.com/gettempcontent\.do\?genurl=[^>]+#',
$content,
$matches
);
if(!$matchCount) { return false; }
//echo "{$matches[0]}<br />";
$content = file_get_contents($matches[0]);
if($content === false) { return false; }
return PDFExtracter::repairDiacritic(
strip_tags(iconv('UTF-8', 'ISO-8859-2//IGNORE', $content))
);
}
static function repairDiacritic($string) {
//preg_replace('/z\s*ˇ/', '', $string, -1, $count);
//if($count > 0) {
//$string = preg_replace('/a\s*´/', 'á', $string);
//$string = preg_replace('/A\s*´/', 'Á', $string);
//$string = preg_replace('/e\s*´/', 'é', $string);
//$string = preg_replace('/E\s*´/', 'É', $string);
//$string = preg_replace('/i\s*´/', 'í', $string);
//$string = preg_replace('/I\s*´/', 'Í', $string);
//$string = preg_replace('/l\s*´/', 'ĺ', $string);
//$string = preg_replace('/L\s*´/', 'Ĺ', $string);
//$string = preg_replace('/o\s*´/', 'ó', $string);
//$string = preg_replace('/O\s*´/', 'Ó', $string);
//$string = preg_replace('/u\s*´/', 'ú', $string);
//$string = preg_replace('/U\s*´/', 'Ú', $string);
//$string = preg_replace('/y\s*´/', 'ý', $string);
//$string = preg_replace('/Y\s*´/', 'Ý', $string);
//
//$string = preg_replace('/c\s*ˇ/', 'č', $string);
//$string = preg_replace('/C\s*ˇ/', 'Č', $string);
//$string = preg_replace('/d\s*ˇ/', 'ď', $string);
//$string = preg_replace('/D\s*ˇ/', 'Ď', $string);
//$string = preg_replace('/e\s*ˇ/', 'ě', $string);
//$string = preg_replace('/E\s*ˇ/', 'Ě', $string);
//$string = preg_replace('/n\s*ˇ/', 'ň', $string);
//$string = preg_replace('/N\s*ˇ/', 'Ň', $string);
//$string = preg_replace('/r\s*ˇ/', 'ř', $string);
//$string = preg_replace('/R\s*ˇ/', 'Ř', $string);
//$string = preg_replace('/s\s*ˇ/', 'š', $string);
//$string = preg_replace('/S\s*ˇ/', 'Š', $string);
//$string = preg_replace('/z\s*ˇ/', 'ž', $string);
//$string = preg_replace('/Z\s*ˇ/', 'Ž', $string);
//
//$string = preg_replace('/a\s*¨/', 'ä', $string);
//$string = preg_replace('/A\s*¨/', 'Ä', $string);
//
//$string = preg_replace('/\S-\s+/', '', $string);
//
//$string = str_replace('´', 'í', $string);
//}
//else {
$string = preg_replace('/´\s*a/', 'á', $string);
$string = preg_replace('/´\s*A/', 'Á', $string);
$string = preg_replace('/´\s*e/', 'é', $string);
$string = preg_replace('/´\s*E/', 'É', $string);
$string = preg_replace('/´\s*i/', 'í', $string);
$string = preg_replace('/´\s*I/', 'Í', $string);
$string = preg_replace('/´\s*l/', 'ĺ', $string);
$string = preg_replace('/´\s*L/', 'Ĺ', $string);
$string = preg_replace('/´\s*o/', 'ó', $string);
$string = preg_replace('/´\s*O/', 'Ó', $string);
$string = preg_replace('/´\s*u/', 'ú', $string);
$string = preg_replace('/´\s*U/', 'Ú', $string);
$string = preg_replace('/´\s*y/', 'ý', $string);
$string = preg_replace('/´\s*Y/', 'Ý', $string);
$string = preg_replace('/ˇ\s*c/', 'č', $string);
$string = preg_replace('/ˇ\s*C/', 'Č', $string);
$string = preg_replace('/ˇ\s*d/', 'ď', $string);
$string = preg_replace('/ˇ\s*D/', 'Ď', $string);
$string = preg_replace('/ˇ\s*e/', 'ě', $string);
$string = preg_replace('/ˇ\s*E/', 'Ě', $string);
$string = preg_replace('/ˇ\s*n/', 'ň', $string);
$string = preg_replace('/ˇ\s*N/', 'Ň', $string);
$string = preg_replace('/ˇ\s*r/', 'ř', $string);
$string = preg_replace('/ˇ\s*R/', 'Ř', $string);
$string = preg_replace('/ˇ\s*s/', 'š', $string);
$string = preg_replace('/ˇ\s*S/', 'Š', $string);
$string = preg_replace('/ˇ\s*z/', 'ž', $string);
$string = preg_replace('/ˇ\s*Z/', 'Ž', $string);
$string = preg_replace('/¨\s*a/', 'ä', $string);
$string = preg_replace('/¨\s*A/', 'Ä', $string);
$string = preg_replace('/\S-\s+/', '', $string);
$string = str_replace('´', 'í', $string);
//}
return $string;
}
}