[thelist] Printing fixed width strings in PHP

Dave Preston caffiend at simianbrotherhood.org
Fri Nov 9 12:38:39 CST 2001


poke around with chunk_split(), it doesn't do pixels but will do
characters, not exactly what you're looking for but it very well may be
your only option.

Good luck..

On Fri, Nov 09, 2001 at 10:52:20AM -0600, zapoleto at altavista.net wrote:
> I´m making a PHP script that prints a MySQL table on the screen, but I
> need to format the fields in a table with a fixed width since the
> table will then be printed by the user and I want the report to
> print correctly in all cases.
> 
> The problem I have is that some fields will be longer and won´t fit in
> the widht I want.  I don´t want the field to wrap either, so I need to
> cut the string before sending it.  Since the nice fonts are all
> variable width, most fields look as if more characters could fit in
> the space because I´m trimming the string by a certain number of
> characters and depending on the characters, the width will vary.
> 
> Is there a function I could use that can trim a string based on the
> number of pixels that the string will occupy when printed ?
> 
> 
> 
> ---------------------------------------
> For unsubscribe and other options, including
> the Tip Harvester and archive of TheList go to:
> http://lists.evolt.org Workers of the Web, evolt ! 
> 




More information about the thelist mailing list