Jump to content

xpdf


willg

Recommended Posts

Hi,

 

I need to call the pdftotext.exe program in a php script. This code is what I have for the windows server. It used to work but doesn't anymore. I cannot change the server settings (so please don't suggest that) so can someone suggest a different coding way to call pdftotext.exe? Many thanks. Note that the pdftotext.exe file is in the same folder as the below script:

 

<?PHP
    $file = "1.pdf";
    $outpath = preg_replace("/\.pdf$/", "", $file).".txt";
    
    system("pdftotext ".escapeshellcmd($file), $ret);
    if ($ret == 0)
    {
        $value = file_get_contents($outpath);
        unlink($outpath);
        print $value;
    }
    if ($ret == 127)
        print "Could not find pdftotext tool.";
    if ($ret == 1)
        print "Could not find pdf file.";
?>

Link to comment
https://forums.phpfreaks.com/topic/78842-xpdf/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.