PHP Classes

How to Convert DOC to TXT using PHP DOC DOCX PDF to Text Converter: Convert DOCX, DOC, PDF to plain text

Recommend this page to a friend!
  Info   View files Example   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum (18)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 56%Total: 5,827 This week: 2All time: 399 This week: 22Up
Version License PHP version Categories
filetotext 1.0The PHP License5.2PHP 5, Text processing, Conversion


This class can convert DOCX, DOC, PDF files to plain text.

It can read files in either Microsoft Word DOCX and DOC formats or PDF and parse the files to extract text they contain.

The text extracted from the documents is returned as a plain text string.

Innovation Award
PHP Programming Innovation award nominee
November 2014
Number 3

Prize: One copy of VS.PHP
File formats like Microsoft Word DOC or PDF are used to create documents that may contain text and other types of document elements.

Parsing and extracting the document elements from files in those formats, usually is not a trivial task. However, if you just want to extract the text in the document, simpler approaches may be used.

This class can extract text from PDF document files as well Microsoft Word files, including the older versions that use a binary file format.

Manuel Lemos
Picture of Aditya Sarkar
  Performance   Level  
Name: Aditya Sarkar <contact>
Classes: 2 packages by
Country: India India
Age: 33
All time rank: 48127 in India India
Week rank: 20 Up3 in India India Up
Innovation award
Innovation award
Nominee: 1x


Extract PDF to text and XML
I need to parse a PDF file and convert whole text into XML

What is the best PHP pdf to text class?
pdf to text format in php

What is the best PHP count characters class?
Get number of characters in a uploaded doc, txt, odt, pdf etc



$docObj = new Filetotext("test.docx");
//$docObj = new Filetotext("test.pdf");
$return = $docObj->convertToText();

var_dump( $return ) ;

  Files folder image Files  
File Role Description
Plain text file class.filetotext.php Class main class file
Plain text file index.php Example example to call

 Version Control Unique User Downloads Download Rankings  
This week:2
All time:399
This week:22Up
User Ratings User Comments (6)
 All time
This one was very useful, i managed an email box crawler, inc...
6 years ago (Vincent DECARPIGNY)
I need to extract text from PDF.
6 years ago (Erwin Moller)
I need to extract text from PDF.
6 years ago (Erwin Moller)
Does not work reliably with PDF.
8 years ago (goodbee)
Very interesting class.
9 years ago (Everton da Rosa)
on peut simplifier juste ceci : return $this->{"read_$file_ex...
9 years ago (Yves Marie HAMAYON)