PHP Classes
elePHPant
Icontem

File: examples/example03/example.php

Recommend this page to a friend!
  Classes of Christian Vigh  >  PHP PDF to Text  >  examples/example03/example.php  >  Download  
File: examples/example03/example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP PDF to Text
Extract text contents from PDF files
Author: By
Last change:
Date: 2 years ago
Size: 518 bytes
 

Contents

Class file image Download
<?php
   
include ( '../../PdfToText.phpclass' ) ;

    function
output ( $message )
       {
        if (
php_sapi_name ( ) == 'cli' )
            echo (
$message ) ;
        else
            echo (
nl2br ( $message ) ) ;
        }

   
$file = 'sample' ;
   
$pdf = new PdfToText ( "$file.pdf" ) ;

   
output ( "Original file contents :\n" ) ;
   
output ( file_get_contents ( "$file.txt" ) ) ;
   
output ( "-----------------------------------------------------------\n" ) ;

   
output ( "Extracted file contents :\n" ) ;
   
output ( $pdf -> Text ) ;