как добавить css-файл в mpdf


Я пытаюсь преобразовать html в pdf с помощью mpdf. Проблема в том, что я не могу применить css к pdf-файлу..

Вот мой код php:

<?php

    $html = $divPrint;
    $mpdf=new mPDF();
    $stylesheet = file_get_contents('pdf.css');
    $mpdf->WriteHTML($stylesheet,1);
    $mpdf->WriteHTML($html,2);
    $mpdf->Output();
    exit;

?>

То, что он делает, - это использует html через ajax на моей этой странице php. Но результат, который он дает, не поставляется с css, который я написал для него..

Пожалуйста, скажите мне, что теперь делать?

Author: Alfred Huang, 2013-03-20

1 answers

 <?php

$html = $divPrint;

include('mpdf.php'); // including mpdf.php
$mpdf=new mPDF();
$stylesheet = file_get_contents('pdf.css'); // external css
$mpdf->WriteHTML($stylesheet,1);
$mpdf->WriteHTML($html,2);
$mpdf->Output();
exit;

?>

1-й назначьте свой html-код в $html, затем включите mpdf.php файл.

 30
Author: Haseeb, 2013-03-22 09:39:45