Brauche Hilfe bei der Positionierung von fpdf
P粉619896145
P粉619896145 2023-09-09 17:54:44
0
1
539

Ich bin neu bei fpdf cell und multicell und benötige Hilfe bei meinem Code. Unten ist der Code, den ich geschrieben habe:

$pdf->Cell(60, 6, 'MAILING ADDRESS', 'L,R', 0);
$pdf->Multicell(65, 5, $puchaser1[0]["address"], 1);
$pdf->Cell(60, 11, $puchaser2[0]["address"], 1);

$pdf->Cell(60, 8, 'PHONE NUMBER', 1, 0);
$pdf->Cell(65, 8, $puchaser1[0]["contact_no"], 1, 0);
$pdf->Cell(65, 8, $puchaser2[0]["contact_no"], 1, 1);

Ich möchte, dass es so aussieht:

P粉619896145
P粉619896145

Antworte allen(1)
P粉752826008

我强烈建议使用更多变量。您的代码可能如下所示:

// Height is different in multicell, this stands for lineheight and should be the same as other cells :)
// I would advise you to go for, SMALL_CELL and BIG_CELL if you want to differentiate
$WIDTH_CELL = 60;
$HEIGHT_CELL = 5;

// Most of the time, you want to border all so let's put this in a variable as well 
// Not in your case though, but more on that below this :)
$BORDER = 1;

$pdf->Cell($WIDTH_CELL, $HEIGHT_CELL, 'MAILING ADDRESS', $border, 0);
$pdf->Multicell($WIDTH_CELL, $HEIGHT_CELL, $puchaser1[0]["address"], $border);
$pdf->Cell($WIDTH_CELL, $HEIGHT_CELL, $puchaser2[0]["address"], $border);

$pdf->Cell($WIDTH_CELL, $HEIGHT_CELL, 'PHONE NUMBER', 1, 0);
$pdf->Cell($WIDTH_CELL, $HEIGHT_CELL, $puchaser1[0]["contact_no"], $border, 0);
$pdf->Cell($WIDTH_CELL, $HEIGHT_CELL, $puchaser2[0]["contact_no"], $border, 1);

但是,这不能解决您的问题。你将会度过一段糟糕的时光,因为你需要:

  1. 跟踪您的起始 Y
  2. 添加多单元格后保存 Y 值
  3. 使用这两个值为整行绘制一个矩形

所有其他边框应具体为“L”、“R”或“LR”。您必须用矩形绘制顶部边框、底部(有时是 L 或 R)边框。

代码很多,所以如果您有这样的代码,我会进一步帮助您:)

Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!