Jump to content


Photo

Printing - # lines used?


  • Please log in to reply
4 replies to this topic

#1 paruby

paruby
  • Members
  • PipPipPip
  • Advanced Member
  • 48 posts

Posted 02 April 2006 - 08:37 PM

I know I can have approx 38 lines of text for a 1 page print out. I can keep track of the # of items I print out that are on their own line. Question is, how can I know if an item takes up 2 or more lines?

Thanx in advance...

Pete

#2 txmedic03

txmedic03
  • Members
  • PipPipPip
  • Advanced Member
  • 313 posts
  • LocationCall, TX, USA

Posted 02 April 2006 - 10:28 PM

You could count the sections based on xx number of characters per line. You could take each line as you have it divided already and then if it is divisable by xx number of characters the result is how many lines it covers. You can use wordwrap to divide the section into lines based on your criteria. If you need some examples, let me know, but for the moment I must head out the door.

SEMPER FIDELIS!

I can't stop you from doing something silly, but at least I can help you do it right.


#3 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 03 April 2006 - 01:18 AM

It is incrediably difficult to control any printing from php. PHP is server side and what happens client side is an different story.

NOW printing is not the same world-wide I am informed that those in the US don't use the A4 size - predominant in european countries.

You absolute best route of atck on this is to use a style sheet. just like anyother style sheet you can create one just for printing by adding the media="print" to the end of the link tag in the head section.

Even then you are not guaranteed exactly what you want different printers and different drivers can alter margin sizes (although you can set them in your style sheet), and any number of default settings that you just cannot account for.
follow me on twitter @PHPsycho

#4 paruby

paruby
  • Members
  • PipPipPip
  • Advanced Member
  • 48 posts

Posted 09 April 2006 - 03:23 AM

thanx, both suggestions are helpful... One final question, is there a way to force a new page?

#5 txmedic03

txmedic03
  • Members
  • PipPipPip
  • Advanced Member
  • 313 posts
  • LocationCall, TX, USA

Posted 09 April 2006 - 06:22 AM

I am sure there is probably a way, but I honestly don't know. The best thing I can say is to add line feeds/carriage returns. Like ToonMariner said, controlling printing from PHP is tricky. I don't work a lot with printing, so I don't know a whole lot about working with printer output from PHP and because of this there is probably an easy way to do it that I just don't know about. If someone has a quick and easy solution, I'd love to know about it just for kicks and grins.

SEMPER FIDELIS!

I can't stop you from doing something silly, but at least I can help you do it right.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users