Skip to content

Instantly share code, notes, and snippets.

View rifkiferdian's full-sized avatar
🏠
Working from home

rifkiferdian rifkiferdian

🏠
Working from home
  • Amikom University
  • Yogyakarta, Indonesia
View GitHub Profile
@rifkiferdian
rifkiferdian / gist:1fe3ae9adf33f062d83f99b27f575205
Created October 18, 2018 07:52 — forked from johnballantyne/gist:4089627
GetMultiCellHeight() script for FPDF
function GetMultiCellHeight($w, $h, $txt, $border=null, $align='J') {
// Calculate MultiCell with automatic or explicit line breaks height
// $border is un-used, but I kept it in the parameters to keep the call
// to this function consistent with MultiCell()
$cw = &$this->CurrentFont['cw'];
if($w==0)
$w = $this->w-$this->rMargin-$this->x;
$wmax = ($w-2*$this->cMargin)*1000/$this->FontSize;
$s = str_replace("\r",'',$txt);
$nb = strlen($s);