CakePdf not outputting styles


#1

I tried FriendsOfCake/CakePdf with Tcpdf, wkhtmltopdf and dompdf but i do not get any colors or styling from my stylesheets. I also tried putting all styles in a tag in the head.

i am using the default templates from a cake installation. I copied the default.ctp and the pdftest.ctp file to a pdf folder. It is all working correctly except I have no styling.

This is my config i load in bootstrap.php at the bottom.

Configure::write('CakePdf', [
    'engine' => [
        // 'binary' => '/usr/local/bin/wkhtmltopdf',
        // 'className' => 'CakePdf.WkHtmlToPdf',
        'className' => 'CakePdf.Tcpdf',
        // 'className' => 'CakePdf.DomPdf',
        ],
    'margin' => [
        'bottom' => 15,
        'left' => 50,
        'right' => 30,
        'top' => 45
    ],
    'orientation' => 'landscape',
    'download' => true
]);

#2

it looks like now i use tcpdf as engine and h3 { color: red;} in the header it is working. The <link tags do not seem to work.

is this expected?

I included the fullBase urls to the stylesheets as per documentation, but still no colors.


#3

I’m quite new on php and Cake developing and experiencing the same problem.

I tried WkhtmltoPdf which works “ok” on command shell but it does not work on the cakephp “demo web” I am developing. Cake is installed on a linux environment Ubuntu 16.04 SRV.

I then tried Cakepdf with Wkhtmltopdf on a Windows server with XAMPP and worked straight away which leads me to believe it is a permissions problem. Still not found a way to solved. Something is puzzling me for days…

Then I tried tcpdf as wschwarte describes above and pdf are generated straight away without isuues except styles are not passed through.

Has anybody solved this issue or can guide us to a proper solution?

Thanks