decor Posted December 16, 2008 Share Posted December 16, 2008 hello I brought a template for html & pdf invoivces from someone here but can nott seem to find the reciept. So can someone help me with wrapping the invoice description? currently i have (the description part only of pdfconfig.php ----------------------------------------- $pdf->Cell(50,9,"Total Amount Due",1,0,'L',1); $pdf->Cell(30,9,$duedate,1,0,'L',1); $pdf->Cell(30,9,$currencysymbol.$grandtotal,1,0,'R',1);$pdf->Ln(); $pdf->SetTextColor(0); $pdf->Cell(80,9,"Balance Brought Forward",0,0,'L',0); $pdf->Cell(30,9,$currencysymbol.$balancebroughtforward,0,0,'R',0);$pdf->Ln();$pdf->Ln(); foreach ($invoiceitems AS $item) { $pdf->Cell(80,0,$item["description"],0,0,'L',0); $pdf->Cell(30,0,$currencysymbol.$item["amount"],0,0,'R',0);$pdf->Ln(); } # TOTALS -------------------------------------------------- which will write one long line across the page when the description is long. How do i wrap the description at say 70 characters? thanks ian 0 Quote Link to comment Share on other sites More sharing options...
sonoracomm Posted December 29, 2008 Share Posted December 29, 2008 Take a look at the latest 3.8.1 pdfconfig.php file. They have implemented new code in the area you are looking at to wrap a bit better. G foreach ($invoiceitems AS $item) { if (strlen($item["description"])>75) { $numlines = ceil(strlen($item["description"])/75); $cellheight = $numlines * 5; $pdf->MultiCell(130,$cellheight,$item["description"],1,'L','',0); $pdf->MultiCell(40,$cellheight,$currencysymbol.$item["amount"],1,'C','',0); $pdf->SetXY(20,$pdf->GetY()); } else { $pdf->Cell(130,6,$item["description"],1); $pdf->Cell(40,6,$currencysymbol.$item["amount"],1,0,'C'); } $pdf->Ln(); } 0 Quote Link to comment Share on other sites More sharing options...
decor Posted December 30, 2008 Author Share Posted December 30, 2008 Thanks for that worked a treat cheers Ian 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.