1
I’m messing with the class Pdfreader to extract text from a PDF document.
I made a very simple document to make a test where only give include in the file PDFreader.class.php
and passed the PDF path with the cited call in the example file inside the folder examples
.
When I try to run this file to return the PDF text the following error appears:
Notice: Undefined index: Font in C: Setti www dg t2 Pdfreader Pdfpage.class.php on line 317
Follow the code in my file:
<html xmlns="http://www.w3.org/1999/xhtml" lang="pt-br" xml:lang="pt-br">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<body>
<?php
include ('PDFreader.class.php');
$PDF = new PDFreader();
try {
$PDF->open('t1t.pdf');
$text = $PDF->readText();
}
catch(PDFexception $e) {
echo '<p style="color: #FF0000; font-weight: bold; text-align: center;">';
echo "$e</p>\n";
}
echo "<h2>Decoded text</h2>
<p>\n";
foreach ($text as $row) {
echo "$row<br />\n";
}
echo "</p>\n";
?>
</body>
</html>
How to fix this?
Yeah, I was hoping for a miracle because I have to get something to read pdf soon, you’d have some that’s not pdfparser???
– Douglas Bernardino
@user1875730, updated the answer with useful links, good luck!
– brasofilo