Studio381 Posted December 12, 2007 Share Posted December 12, 2007 I've got an application that prints out to a file in PDF fomat. The PDF routine I'm using truncates the input strings if they are over approx 100 characters. So I wanted to check the input strings (length unknown) and split them before calling the PDF routine. I'd thought of something like... $workingstring = $_POST[inputstring]; while (strlen($workingstring)>90 {$printstring=substr($workingstring(0,90); $pdf->Cell(0,10,$printstring,0,1); $workingstring=substr_replace($workingstring,"",0,90); } $pdf->Cell(0,10,$workingstring,0,1); This (assuming it works, I haven't tried it yet) has the drawback that it splits the string after 90 characters which could be in the middle of a word and I'd much rather split the string after eg 85 or 94 characters to avoid splitting words. Can anyone show me a better way to do this? Thanks, John. 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.