0

I need a pdf to be generated with name being placed on top of an image at a particular place. I have written a working HTML code but mpdf is unable to load the stylesheets and the name is getting printed below the image.

Here is my code of php:

<?php
$html = file_get_contents('index12.html');

require_once __DIR__ . '/vendor/autoload.php';

$mpdf = new \Mpdf\Mpdf();
$stylesheet = file_get_contents('style.css');
$mpdf->WriteHTML($stylesheet, 1);

$mpdf->WriteHTML($html,2);
$mpdf->Output();

index12.html

<!-- <link rel="stylesheet" href="style.css"> -->

<div class="image">

      <img src="yugmak.jpg" alt="" />

      <h2>Kung Fu Panda</h2>

</div>

style.css

@font-face {
  font-family: "Montez";
  src: url("Montez.ttf");
}

.image {
 position: relative;
 width: 100%; /* for IE 6 */
}

h2 {
 position: absolute;
 font-family: "Montez";
 font-size: 250px;
 top: 2100px;
 padding-left: 1050px;
 width: 2000px;
}

Any way to make the css work in pdf would be great.

axelonet
  • 113
  • 5

0 Answers0