0

I need your help to fix this:

My current code is this:

<?php 
      require_once '../dompdf/autoload.inc.php';
      use Dompdf\Dompdf;

      $dompdf = new Dompdf();
      $html = 'Insert full HTML content';
      $dompdf->loadHtml($html);
      $dompdf->setPaper('A4', 'landscape');
      $dompdf->render();
      $dompdf->stream("codexworld",array("Attachment"=>0));
?>

This is the error a get:

Why if I have exactly the same code like the basic example, am I getting this error? What am I missing? I don't find in my folder the Autoloader.php, where do I have to get that file?

3
  • 1
    Could you share the link to the example you're trying to follow? Commented Jun 19, 2016 at 20:59
  • @JeffPuckettII github.com/dompdf/dompdf Commented Jun 19, 2016 at 21:27
  • It's listed in the requirements section. Composer should grab the dependencies composer require dompdf/dompdf Commented Jun 19, 2016 at 21:34

1 Answer 1

3

Well apparently it's an issue after domPdf has moved to Github. It seems that php-font-lib library doesn't exist. So one solution is to manually download it:

or you can check this answer here

Sign up to request clarification or add additional context in comments.

1 Comment

thank you, it works... after i did that, displayed another similar error but with other folder. i fixed it as the same way require_once DIR . '/lib/html5lib/Parser.php'; require_once DIR . '/lib/php-font-lib/src/FontLib/Autoloader.php'; require_once DIR . '/lib/php-svg-lib/src/autoload.php'; now i could convert a simple text to PDF

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.