sidd
sidd

Reputation: 105

Not able to generate pdf with logo

I'm not able to get my PDF printed if I add a logo in my template_header.php file. If I enable include_once("template_header.php") it's not generating any PDF, and it reports this error message:

PHP Fatal error:  Call to undefined function imagecreatetruecolor()

If I disable my header (i.e. above the include_once line) it's generating a PDF without a logo and containing text only.

I tried enabling below, but the same problem persists:

define("DOMPDF_ENABLE_REMOTE", true);

My dompdf ver. is dompdf_0-6-0_beta3.

Can anyone help me on this?

Below is the updated code

require_once("dompdf/dompdf_config.inc.php"); 
$dompdf = new DOMPDF();
$html = '
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>booking</title>
<link rel="stylesheet" href="style/style.css" type="text\css" media="screen" />

</head>
<body>

<div align="center" id="mainwrap">
<?php include_once("template_header.php")?>

</div>
</body>
</html>';
$dompdf = new DOMPDF(); 
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("sample.pdf");

Upvotes: 0

Views: 932

Answers (1)

swapnesh
swapnesh

Reputation: 26732

Please check your GD library installation in php.

Run <?php phpinfo(); ?> in a php file and check for GD library then

enter image description here

Update -

Check your php.ini and look for extension=php_gd2.dll

If ; [commented] then un comment it and restart the services then.

Upvotes: 3

Related Questions