简体   繁体   中英

Make text wrap in a cell with FPDF?

Right now when I use a cell with text, it all stays on one line. I know I could use the write function, but I want to be able to specify the height and width.

This is what I have now, but as I said the text does not wrap to stay in the dimensions:

$pdf->Cell( 200, 40, $reportSubtitle, 1, 1 );

Text Wrap:

The MultiCell is used for print text with multiple lines. It has the same atributes of Cell except for ln and link .

$pdf->MultiCell( 200, 40, $reportSubtitle, 1);

Line Height:

What multiCell does is to spread the given text into multiple cells, this means that the second parameter defines the height of each line (individual cell) and not the height of all cells (collectively).

MultiCell(float w, float h, string txt [, mixed border [, string align [, boolean fill]]])

You can read the full documentation here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM