tecnickcom / TCPDF

Official clone of PHP library to generate PDF documents and barcodes
https://tcpdf.org
Other
4.18k stars 1.51k forks source link

fieldset not working #624

Open maha-oueghlani opened 1 year ago

maha-oueghlani commented 1 year ago

I want to add a fieldset in my pdf file like this code but it is not rendred :

<fieldset style="margin-bottom: 15px;">
                                <legend style="font-size: 25px;font-weight: bold;"  >sebcer: </legend>

                                <p>  '.$co_name.' <br>
                                '.$adrs_med.' <br>
                                '.$p_num.'  </p> 
                            </fieldset>
williamdes commented 1 year ago

Can you provide the tcpdf code you use to generate the pdf?

maha-oueghlani commented 1 year ago

@williamdes here is the code :


function generatePDF($width , $height , $comp, $co_num, $web, $adrs, $co_name, $adrs_med, $p_num) 
{
$pageLayout = array($width, $height); 
$pdf = new TCPDF('p', 'mm', $pageLayout, true, 'UTF-8', false);

$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);

$lg = Array();
$lg['a_meta_charset'] = 'UTF-8';
$lg['a_meta_dir'] = 'rtl';
$lg['a_meta_language'] = 'fa';
$lg['w_page'] = 'page';

$pdf->setLanguageArray($lg);
$pdf->AddPage();
$pdf->setJPEGQuality(75);
$pdf->SetFontSize(10);
$pdf->setRTL(true);
$pdf->SetFont('aealarabiya', '', 10);
 $html = '
    <html>
    <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
        <style>
            @media print {
                footer {
                position: fixed;
                bottom: 0;
                }

                .content-block, p {
                page-break-inside: avoid;
                }

                html, body {

                }
            }

            * {
                direction: rtl;
                }

                p {
                font-size: x-large;
                margin: 3px;
                font-weight: bold;
                }

                .logo-cell {
                width: 25%;
                }
                img {
                max-width: 140px;
                }
                .with-background {
                background-color: grey;
                color: white;
                font-size: large;

                }
                .add-separator {
                border-right: solid 2px black;
                }
                svg {
                width: 100%;
                }
                hr {
                margin: 5px;
                }

            #customers {
                font-family: Arial, Helvetica, sans-serif;
                border-collapse: collapse;
                width: 100%;

            }

            #customers td, #customers th {
                border: 1px solid black;
                padding: 8px;
                font-size: x-large;
            }

            #customers tr:nth-child(even){background-color: #f2f2f2;}

            #customers th {
            text-align: center;

                color: black;
            }

        </style>           

        </head>

        <body style="direction: rtl;   " >
    ';
// some php codes

$html.=' 
                            <fieldset style="margin-bottom: 15px;">
                                <legend style="font-size: 25px;font-weight: bold;"  >المرسل : </legend>

                                <p>  '.$co_name.' <br>
                                '.$adrs_med.' <br>
                                '.$p_num.'  </p> 
                            </fieldset>
<fieldset style="margin-top: 15px;margin-bottom: 15px;">
                                <legend style="font-size: 25px;font-weight: bold;">المستلم : </legend>

                                <p>  '.$row['recv'].' <br>

                                '.$row['adrs1'].' ,  '.$row['adrs3'].' <br>';
$pdf->WriteHTML($html, true, 0, true, 0);
$pdf->Output('example_018.pdf', 'I');
}
williamdes commented 1 year ago

Thank you for this example code, I was thinking I would have time to debug this. But unfortunately I do not have time anymore, feel free to see if you can find something on your side, you can open a pull-request and I will review it