Mpdf: Why is border-radius property not working when used on <td> tag inside a table?

Created on 12 Jan 2018  路  4Comments  路  Source: mpdf/mpdf

Please use https://stackoverflow.com/questions/tagged/mpdf for all your general questions or troubleshooting!
For contributing here, please see the guideline: https://github.com/mpdf/mpdf/blob/development/.github/CONTRIBUTING.md

I found this bug / would like to have this new functionality

Why is border-radius property not working when used on tag inside a table?

This is mPDF and PHP version and environment (fpm/cli etc) I am using

mPDF Drupal module
PHP 5

This is a PHP code snippet I use

<?php
$html='<table><tr><td style="background-color:black;padding:10px;border-radius:10px;">TEST</td></tr></table>';
if($downloadType == 'server'){

        variable_set('pdf_using_mpdf_pdf_save_option', 2);
        $filename = $surveyDetail->title . '_' . time();
        pdf_using_mpdf_api($html, $filename);
        $filename = $filename . '.pdf';
        $filePath = 'sites/default/files/pdf_using_mpdf/' . $filename;
        $attachment = array(
            'filecontent' => file_get_contents($filePath),
            'filename' => $filename,
            'filemime' => 'application/pdf',  
        );
        return $attachment;
    }else{
        variable_set('pdf_using_mpdf_pdf_save_option', 1);
        pdf_using_mpdf_api($html, $surveyDetail->title);
    }
?>

This is a HTML/CSS code snippet I use


Most helpful comment

It seems that border-radius is supported on <div> tags but even if I create a div inside a <td> html and then assign inline CSS for border-radius to that <div> in <td> then too it is not working. Is there any workaround for this? I have to use the table and cannot remove it.

All 4 comments

I guess it is using mPDF version 6
Code is at: http://cgit.drupalcode.org/PDF_using_mPDF/
The export happens in http://cgit.drupalcode.org/PDF_using_mPDF/tree/pdf_using_mpdf.module

Is this property listed as supported for tables in https://mpdf.github.io/css-stylesheets/supported-css.html ?

Border radius is not supported on table-related elements. See supported css link above.

It seems that border-radius is supported on <div> tags but even if I create a div inside a <td> html and then assign inline CSS for border-radius to that <div> in <td> then too it is not working. Is there any workaround for this? I have to use the table and cannot remove it.

Not that I know of. There is a limited CSS support for all elements inside tables.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

akaDJon picture akaDJon  路  5Comments

blacksheep-dev picture blacksheep-dev  路  4Comments

t-me picture t-me  路  3Comments

chaptan picture chaptan  路  4Comments

BernhardBaumrock picture BernhardBaumrock  路  3Comments