Solved

Is it possible to count lines

Posted on 2001-06-13
13
169 Views
Last Modified: 2010-04-09
I am generating html in a vb dll to be displayed in a frame for printing by the user.  I need to place an image at the bottom of the each printed page (like a footer).  Is there a way to count lines?  
In my old word processing days I could determine how much of the page had been used by getting the pts size off the font being used.  Now in html with tables and
's, I was wondering if there was an easy way to assess line count.  Can anyone tell me?

MORE INFO ON MY DESIGN:
My design consists of storing multiple templates in a database.  A header, a body and a footer.  The body is used to present the data elements on the page.  At some point I need to stop placing data elements on the page and put the footer down, before starting a new page.  I was considering adding a field to the database and record the base count of lines each template uses, and then in code add lines as the body of individual data grows, or subtract lines for the items the user wants to supress from print.  Is there an easier way?  Like a Height property on an image?
0
Comment
Question by:LMylan
  • 4
  • 2
  • 2
  • +4
13 Comments
 
LVL 8

Expert Comment

by:edemcs
ID: 6187112
Because this is a webpage you are talking about, you can have an infinite number of lines.  So you need to design a template that is so many lines long, and build your pages dependent upon that format.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 6187292
If you are doing this for an intranet app, where you have total control of
browser and printer setting you might be able to do this.  In all other cases
there is no chance you will optimize the printing.  The format of the printed
page is affected by resolution, preferences setting, local browser options,
local print settings and the whim of the user.  

HTML pages are optimized for screen display and do not print well under even
under ideal conditions.  The standard approach is to the document in printer
fiendly format like PDF.


Cd&
0
 
LVL 19

Expert Comment

by:DreamMaster
ID: 6190221
Well...if you would place all the lines in a layer you should be able to calculate the height using the height of the contents of that layer devided by the lineheight of the layer....

Max.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 6190541
The problem is printing so count the number of lines you think should go on a page put in the image and after the image add:

<p style="page-break-after:always">&nbsp;</p>

Works in IE only guarantees you will page bread at the specified point, but does not guarantee the formating will be ideal.

Cd&
0
 
LVL 19

Expert Comment

by:webwoman
ID: 6190662
And it still doesn't ensure that they've got the printer you assume they'll have -- or that they've not got it set landscape, or have different paper loaded, or a different paper cartridge selected, etc. You won't know, and they can change any printer settings without reloading the page, so you have no way of knowing -- no matter what you check or how many scripts you run.

Don't use HTML for anything that you want printed a certain way. It's bound to print wrong for somebody -- and the more you try to control it, the more people it's going to be wrong for.
0
 
LVL 1

Accepted Solution

by:
Ernest022699 earned 50 total points
ID: 6209143
It is A Bad Idea to try to format a Web Page as if it were printed documentation.  If you wanted to do faxing, then you'd be in the right ballpark, but not on the Web.

A different mindset is needed.  Here's the basic premise:
Users need to see a comfortable lump of stuff at once.  How much constitutes that lump depends on whether it is solid text in paragraphs (not optimal), text and light graphics (ideal), or mostly graphics (too long to load).  

If you haven't been to WimpyPoint (http://wimpy.arsdigita.com/) it is well worth the trip to see some of the presentations as well as the book excerpts!

Each Page should contain a lump that belongs together.  If you're writing about your seven-day hike, then breaking it down into seven Pages makes sense.  Put a series of "previous", "beginning", "next", and "home" links at the bottom of each Page and the user will probably be happy.

You must always keep in mind that people may be using text-to-speech or Braille browsers, for example.  Those people probably won't ever be printing your Pages.  Because screen sizes vary all over the lot, each user's window can be a different size.

If you'd like to tell us what kind of thing you'll be publishing I'm sure we can give you suggestions about breaking the data into manageable Pages.  Don't try to control the user; it won't work.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Expert Comment

by:teacher_mod
ID: 6374503
This question has been abandoned. Would the experts please indicate how
this should be closed out. Is there a comment which should be accepted?
Should the points be split? Should it be reduced to zero points and PAQed?
should it be deleted?  In the absence of direction, the default will be
for me to delete.

TIA for helping to clean up the old questions.

teacher_mod
Community Support Moderator
Experts-Exchange
teacher_mod@experts-exchange.com


0
 
LVL 1

Expert Comment

by:Ernest022699
ID: 6374934
teacher_mod: This is one of the extremely few times when you will see me asking to have my comment accepted as the answer.

My second choice is to have you split the points among us.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 6375550
These very often end up split.  Give it to Ernest, we at least got something a little different on this one.  If you are going to split, give my share to Ernest anyway.

Cd&
0
 
LVL 19

Expert Comment

by:webwoman
ID: 6375819
Give it to Ernest... he gave a good explanation, somebody might actually listen to him for a change. ;-)
0
 
LVL 19

Expert Comment

by:DreamMaster
ID: 6375966
I agree....give points to Ernest...

Max.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 6520245
It is time to clean this abandoned question up.  

I am putting it on a clean up list for CS.

<recommendation>
POINTS TO Ernest

</recommendation>

If anyone participating in the Q disagrees with the recommendation,
please leave a comment for the mods.

Cd&
0
 
LVL 1

Expert Comment

by:kodiakbear
ID: 6521663
Accepting Ernest's comment as answer
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
HTML and CSS for a complex page 20 61
Apostophes in PHP generated form 6 39
Synchronizing CSS load 3 29
html5 auto send email 7 22
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now