Error in DOMPDF library constant

Asked

Viewed 458 times

3

I installed the dompdf package on laravel4, using Composer. However, you are giving the following error when trying to create the object:

Use of Undefined Constant DOMPDF_TEMP_DIR - assumed 'DOMPDF_TEMP_DIR'

The php being used is 5.3.10, Aravel 4.0.10

code of creation:

$pdf = new DOMPDF();

dompdf definitions file code:

def("DOMPDF_TEMP_DIR", sys_get_temp_dir());

Even with amendment of that definition or inclusion by include, the error persists.

Does anyone know the reason for the mistake or has been through this problem?

1 answer

1


From what I read in the documentation, you must require the DOMPDF configuration file, before instantiating the object.

require_once '/path/to/vendor/dompdf/dompdf/dompdf_config.inc.php';

I recommend putting in the file /app/start/global.php

Source: https://github.com/dompdf/dompdf#install-with-Composer

Browser other questions tagged

You are not signed in. Login or sign up in order to post.