PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of The Algoslingers   My PDF to Text   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Example file
Class: My PDF to Text
Parse a PDF document to extract the text contents
Author: By
Last change: Changed required file name
Date: 5 months ago
Size: 870 bytes
 

Contents

Class file image Download
<?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>