Jump to content

Hp - Determining Number Of Characters/lines Per Page


Jagand

Recommended Posts

Is there a way I can know number of characters per line and number of lines that can fit into a page. My specific need is for page format 'Times New Roman' with A4 page format but I would like to know if there is a function in general that can help me with these details.

 

My requirement is like this - write data into a document and when the number of characters written is large enough to fit a page, I must give a page break and write rest of characters to a new page and so on. I can write a custom function for this but the term "formatted printing" associated with function printf, sprintf tempted me to think that PHP might already have a function that does this task and that a new custom function would be unnecessary.

 

One of the complexities with creating a custom function is that non Monospaced fonts such as 'Times New Roman' take different lengths for different characters

Link to comment
Share on other sites

Thank you. That is where things are looking complicated to me. Do you think its possible through PHP to determine the height of multitext data printed so far or use CSS to make a page look like its a new page when after certain height of text is printed?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.