TCPDF Specific Border for Different Sides

I just started using TCPDF (HTML output) and I don’t understand why I can’t have an inline CSS style for the border, as shown below,

style="border-right: 1px"

After looking at some examples, the only place where I see the borders used is on the table using the border = "1" property. This is very annoying, and I hope there is a way to use all the inline CSS instead of the old HTML attributes such as "border".

Thanks for any help, Metropolis

+3
source share
5 answers

5.7 TCPDF (http://www.tcpdf.org) CSS, . , .

:

border-right: 1px solid black;
+6

, tcpdf, , css. , tcpdf cant.

writeHtml , . , 1px tr td div.

tcpdf ( writeHtml pdf, tcpdf):

, :

if (isset($dom[$key]['content'])) {
    $cell_content = $dom[$key]['content'];
} else {
    $cell_content = ' ';
}

:

if (isset($dom[$key]['attribute']['border'])) {
    $cell_borderHack = $dom[$key]['attribute']['border'];
} elseif (isset($dom[$trid]['attribute']['border'])) {
    $cell_borderHack = $dom[$trid]['attribute']['border'];
} else {
    $cell_borderHack = false;
}

:

$this->MultiCell($cellw, $cellh, $cell_content, false, $lalign, false, 2, '', '', true, 0, true);

:

$this->MultiCell($cellw, $cellh, $cell_content, $cell_borderHack, $lalign, false, 2, '', '', true, 0, true);

, , "TRBL" border html-. .:  - > Border 1px .

, HTML: J, .

, dompdf - utf-8, , Pdf , .

Tcpdf - php, , utf-8 (, , ).

+3

TCPDF 5.9.010 (2010-10-27) - Added support for CSS border properties and table spacing. The latest version when I write this message: TCPDF 5.9.034 (2010-12-19)

+2
source

This is strange, but you can draw the border yourself using the Line method.

Example

$style = array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0));
$this->Line(x1, y1, x2, y2, $style);
+1
source

Unfortunately, TCPDF does not support FULL CSS is hoping someone got some quick magic to fix this, or maybe the developer himself can make it compatible with the next version.

0
source

Source: https://habr.com/ru/post/1741305/


All Articles