Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dompdf fails to load

I am trying to get dompdf running on an in-house server. With the default config.inc.php settings, I get the following when running the equivalent of the demo 'Hello Wolrd' script:

Warning: require_once(/var/www/dompdf-master/lib/php-font-lib/classes/font.cls.php): failed to open stream: No such file or directory in /var/www/dompdf-master/dompdf_config.inc.php on line 335 Fatal error: require_once(): Failed opening required '/var/www/dompdf-master/lib/php-font-lib/classes/font.cls.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/dompdf-master/dompdf_config.inc.php on line 335  

When I turn off DOMPDF_ENABLE_AUTOLOAD, I no longer get this warning, but the code fails with the following:

Fatal error: Class 'DOMPDF' not found in /var/www/rfq/test.php on line 115 

The following is the code:

require_once("/var/www/dompdf-master/dompdf_config.inc.php");  $dompdf = new DOMPDF(); // this is the line that fails $dompdf->load_html($quotehtml); $dompdf->render(); $dompdf->stream("rfq".$_REQUEST['quoteid'].".pdf"); 

This is Ubuntu 12.04, up-to-date on patches, with default Apache settings.

Thanks so much.

like image 741
Mark T. Johns Avatar asked Feb 22 '13 16:02

Mark T. Johns


People also ask

Why does it say failed to load PDF document?

The “Failed to Load PDF Document” error message indicates that the web browser you are using, Google Chrome, is trying to open the electronic transcript within its own native PDF viewer. Because the transcript is a secured PDF, it must be opened with Adobe Acrobat Reader.

What is Dompdf in laravel?

Dompdf is a query based on the Laravel framework that will help generate a pdf file. It can be integrated in any environment, based on a Laravel framework.


2 Answers

  • Go to https://github.com/PhenX/php-font-lib and download the library.
  • Create the dompdf/lib/php-font-lib/classes/ directory.
  • In the zip file, take the contents of the src/FontLib/ folder and paste that into your newly created directory.

That seemed to work for me.

like image 89
Mikepote Avatar answered Oct 11 '22 19:10

Mikepote


This is a temporary issue after the DOMPDF project moved to Github. See the answers to this question. The easiest solution to get the complete package is to download DOMPDF 0.6 beta 3 from Google Code.

like image 36
Jpsy Avatar answered Oct 11 '22 19:10

Jpsy