I'm messing with the PDFreader class to extract text from a PDF document.
I made a very simple document to do a test where I only include include in the file PDFreader.class.php
and I passed the path of the PDF with the call quoted in the sample file inside the folder examples
.
When I try to run this file to return the text from the PDF, the following error appears:
Notice: Undefined index: Font in C: \ setti \ www \ dg \ t2 \ PDFreader \ PDFpage.class.php on line 317
Here is the code that is 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?