https://php-xpdf.readthedocs.io/en/latest/
The first problem was trying to install composer. I already have curl installed, PHP 5.6.25 installed but when I tried installing using their curl example :# Install composer
curl -s http://getcomposer.org/installer | php
# Upgrade your install
php composer.phar install
it errored out.https://getcomposer.org/doc/00-intro.md
and selected 'developer' and from the cmd line, I executed composer -v. It appears to be installed correctly. (In my previous attempts, I used the option of everyone but thought better of it so I uninstalled it, reboot my computer and installed using developers mode.http://www.xpdfreader.com/download.html
c:\wamp\www\PDFConvert
My Vendor folder path is:c:\wamp\www\PDFConvert\Vendor
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('PDF-book.pdf');
// PDF text is now in the $text variable
$text = $pdfToText->getText();
$pdfToText->close();
{
"require": {
"monolog/monolog": "^1.25",
"php-console/php-console": "^3.1"
"php-xpdf/php-xpdf": "master"
}
}
I even preceded the previous locations with vendor/ and tried it.<?php
require 'vendor/autoload.php';
...carry on coding
ASKER
"vendor/monolog/monolog": "^1.25",
"vendor/php-console/php-console": "^3.1",
on the basis of "The requires package vendor monolog/monolog could not be found in any version. there may be a typo error in the package name"ASKER
ASKER
PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.
TRUSTED BY
1) Do you have composer installed? composer -v is what shows you have it installed.
2) Did you install xpdf?
In order to use PHP-XPDF, you need to install XPDF. Depending of your configuration, please follow the instructions at on the XPDF website. and the link they provide goes to http://www.xpdfreader.com/download.html
3) " Class 'XPDF\PdfToText' not found in C:\wamp\www\PDFConvert\tes
Post your entire code for testpdf.php
4) What are the major folders you have in your vendor file? Do you have all the dependencies? This is where using composer comes in.
5) Are you loading the required files? With composer there should be a line
Open in new window