HTML to PDF how can i convert into PDF?

Well, i have used friendsofcake/cakepdf .This plugin used but i have design one certificate which is in html and css format when i call the function to convert pdf it will show the separate parts of certificate. css will not apply after the pdf conversion. how can resolve this type problem …Please suggest some solution

Which engine are you using? Can you post some example code of what you’ve tried?

Thanks for reply post.I have solved this problem, & i have used wkhtmltopdf engine.i have not to set default layout in pdf folder so the css will not to set to my acutal pdf.

This is my Controller function …

public function exportpdf()
            $invoice = $this->Countries->find();
                'pdfConfig' => [
                    'orientation' => 'portrait',
                    'filename' => 'certificate_'
            $this->set('invoice', $invoice);
///////////////////////////////////    this is bootstrap.php setup ////

Configure::write('CakePdf', [
    'engine' => [
        'className' => 'CakePdf.WkHtmlToPdf',
        'binary' => '/usr/bin/wkhtmltopdf', //LINUX
        //'binary' => 'C:\PROGRA~1\wkhtmltopdf\bin\wkhtmltopdf.exe', //WINDOWS
        'options' => [
            'print-media-type' => true,
            'outline' => true,
            'dpi' => 96
    'pageSize' => 'Letter',

But when i call the function it’s was long run but not any output.

I have got an error failed to load Failed to load PDF document. i have check git error posting same issue. but my app have no errors. but getting this error.

I have always ran into permission issues when I get PDF generation errors. Try pushing the file to a very public location (/app/tmp/ or /tmp) and ensure permissions are 777 for the directory, just as a test. Sometimes www-data is trying to write the pdf, but it doesn’t have write permissions for /usr/bin/…