jdadwilson Posted September 1, 2007 Share Posted September 1, 2007 I am working on a calendar system in which I print a monthly calendar to pdf. Each day of the month is a fixed width and height and contains events for the day. I am looking for a snippet of code that will wrap the text so that it will not overwrite into the next box. Presently I am just limiting the width to a certain number of characters but that does not work well given the differing width of characters. Additionally, I would prefer to wrap on a space rather than in the middle of a word. Any solutions would be most appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/67543-assistance-with-text-wrapping/ Share on other sites More sharing options...
Ken2k7 Posted September 1, 2007 Share Posted September 1, 2007 Well ignoring the pdf, if you use a <table> and assign it's widths, the text should wrap itself. Quote Link to comment https://forums.phpfreaks.com/topic/67543-assistance-with-text-wrapping/#findComment-339184 Share on other sites More sharing options...
pyrodude Posted September 1, 2007 Share Posted September 1, 2007 Or, you could use the php wraptext() function if you're creating the pdf file dynamically. Learn more: http://www.w3schools.com/php/func_string_wordwrap.asp Quote Link to comment https://forums.phpfreaks.com/topic/67543-assistance-with-text-wrapping/#findComment-339285 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.