Reading PDF Files
To read PDF files, you will need to install the XPDF package, which includes "pdftotext." Once you have XPDF/pdftotext installed, you run the following PHP statement to get the PDF text:
$content = shell_exec('/usr/local/bin/pdftotext '.$filename.' -'); //dash at the end to output content
Reading DOC Files
Like the PDF example above, you'll need to download another package. This package is called Antiword. Here's the code to grab the Word DOC content:
$content = shell_exec('/usr/local/bin/antiword '.$filename);The above code does NOT read DOCX files and does not (and purposely so) preserve formatting. There are other libraries that will preserve formatting but in our case, we just want to get at the text.
'개발 > php' 카테고리의 다른 글
PHP 5.5.x (0) | 2013.08.15 |
---|---|
php.ini 보안 (0) | 2012.02.05 |
Send Files via FTP Using PHP (0) | 2011.12.21 |
Force A Secure Page Using PHP (0) | 2011.12.21 |
Force Secure (SSL) Pages With .htaccess (0) | 2011.12.21 |