alchemy-fr / PHP-XPDF

An object oriented wrapper for XPDF
Other
37 stars 26 forks source link

Error In MY code #3

Closed prakashbisht closed 11 years ago

prakashbisht commented 11 years ago

Error: Class 'XPDF\PdfToText' not found File: D:\wamp\www\users\app\View\Users\pdf2text.ctp Line: 13 i got this issue why this happen and what meaning of 'Class 'XPDF\PdfToText' not found' pls help me thanks

romainneutron commented 11 years ago

Are you using composer to autoload PHP-XPDF ? If you're not using composer, how do you load the library ? You should provide the code snippet that fails, otherwise we can not help you so much

prakashbisht commented 11 years ago

yes i use autoload in my script installing composer my code is <?php require 'D:\wamp\bin\php\php5.4.3\vendor/autoload.php'; use Monolog\Logger; use Monolog\Handler\NullHandler; use XPDF\PdfToText;

// Create a logger $logger = new Logger('MyLogger'); $logger->pushHandler(new NullHandler());

// You have to pass a Monolog logger // This logger provides some usefull infos about what's happening $pdfToText = PdfToText::load($logger);

// open PDF $pdfToText->open('oops.pdf');

// PDF text is now in the $text variable $pdfToText->getText(); $pdfToText->close(); ?>

romainneutron commented 11 years ago

What your composer.json look like ? Have you run php composer.phar update after adding php-xpdf as a dependency ?

As XPDF\PdfToText is provided by php xpdf, composer should provide it via autoloader

prakashbisht commented 11 years ago

my composer.json code is { "require": { "monolog/monolog": "1.2.*" }, "autoload": { "psr-0": {"Acme": "src/"} } } bt i do not get this As XPDF\PdfToText is provided by php xpdf, composer should provide it via autoloader how i use this

prakashbisht commented 11 years ago

hi can you give me complete code or step of this.this code i done to read pdf and write in text file in cakephp

romainneutron commented 11 years ago

If you're using composer autoload to load PHP-XPDF, then you must load php-xpdf through composer :

{
    "require": {
        "monolog/monolog": "1.2.*",
        "php-xpdf/php-xpdf": "~0.1"
    },
    "autoload": {
        "psr-0": {"Acme": "src/"}
    }
}

This is actually explained in the documentation http://php-xpdf.readthedocs.org/en/latest/

prakashbisht commented 11 years ago

hi i alredy hepled this site is download php-xpdf and put on my php library but could not get write answer ??