PHP Classes

My PDF to Text: Parse a PDF document to extract the text contents

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-02-08 (6 months ago) RSS 2.0 feedNot enough user ratingsTotal: 136 This week: 1All time: 9,268 This week: 59Up
Version License PHP version Categories
pdf-my-text 1.0.0MIT/X Consortium ...5PHP 5, Files and Folders, Text proces..., D..., P...
Description 

Author

This class can parse a PDF document to extract the text contents.

It can take the file name of a PDF document as a parameter and parses the document file.

The class can extract the document's text and return it as a string.

This class convert PDF file to raw text which can be saved as .txt/.doc/.whatever or can be copied and pasted to anywhere.

Picture of The Algoslingers
  Performance   Level  
Name: The Algoslingers <contact>
Classes: 9 packages by
Country: Ghana Ghana
Innovation award
Innovation award
Nominee: 5x

Winner: 1x

Recommendations

want to display a pdf file
want to display a pdf file in a web page

Instructions

Download and add the PDFMyText class to your project.

Call the PDFMyText() class or see the index.php file for example usage.

Example

<?php
require('class.pdfmytext.php');

extract($_POST);
 

if(isset(
$readpdf)){

    

    if(
$_FILES['file']['type']=="application/pdf") {

       
$a = new PDFMyText();

       
$a->setFilename($_FILES['file']['tmp_name']);

       
$a->decodePDF();

        echo
$a->output()."<br>";

    }

     
    else {

        echo
"<p style='color:red; text-align:center'>

            Wrong file format</p>
"
;

    }
}
?>
<!doctype html>
<html>
  <head>
    <meta name="viewport" content="width=device-width"/>
    <title>PDF to TEXT < By @TheAlgoslingers</title>
  </head>
  <body style="text-align:center;padding:15px">
    <form method="post" enctype="multipart/form-data">
      <input type="file" name="file" />
      <br><br>
      <input type="submit" name="readpdf" value="Convert"/>
    </form>
  </body>
</html>


  Files folder image Files (2)  
File Role Description
Plain text file class.pdfmytext.php Class Main class file
Accessible without login Plain text file index.php Example Example file

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:136
This week:1
All time:9,268
This week:59Up