Problem in extracting text using PDFReader API

1

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?

    
asked by anonymous 11.06.2014 / 17:11

1 answer

1

The code you posted works in OS X. On the package site we see the following :

  

Emphasismine:ItmightworkunderWindows.
Andbeingthelastupdateof2010,Ithinkrunningonyoursystem(C:\)willbe...complicated.

Options:

Doing this search , I found a Q & A in Stack Overflow with several suggestions: Is there a PDF parser for PHP? . In addition to the visible responses, there are a couple of deleted links whose links can be useful here:

11.06.2014 / 18:59