I recently today downloaded the dompdf library for one of my project i downladed it in a zip format and then extracted to my xampp->htdocs->project folder and then the typed the following code to check whether its working or not,
<?php
require_once 'dompdf/src/Autoloader.php';
use Dompdf\Dompdf ;
$dompdf = new Dompdf();
$dompdf->loadHtml(file_get_contents('index.php'));
$dompdf->setPaper('A4','landscape');
$dompdf->render();
$dompdf->stream();
?>
I am completely new here have no idea about this version of dompdf that i downloaded is 0.8.0 which is the current one, how can i fix this
It looks like you downloaded the source code, not a packaged release. The source code download does not include all the dependencies (e.g. php-font-lib) necessary to fully use Dompdf so if you want to use the source code you'll need to download these dependencies separately and also reference their autoloaders.
The recommended method of installing Dompdf is via Composer.
First from the command line: composer require dompdf/dompdf
.
Then just use Composer's autoloader in your code: require 'vendor/autoload.php';
If you are unable to use Composer the next recommended method is to download the packaged release. The packaged release includes an autoloader and all dependencies. After installing just reference the included autoloader: require_once 'dompdf/autoload.inc.php';
.
If you prefer to continue using the source code directly you'll want to download the dependencies and then load each in turn. (this discussion may help).
require_once '/dompdf/lib/html5lib/Parser.php';
require_once '/php-font-lib/src/FontLib/Autoloader.php';
require_once '/php-svg-lib/src/autoload.php';
require_once '/dompdf/src/Autoloader.php';
Dompdf\Autoloader::register();
use Dompdf\Dompdf;