Solved

Is it possible to count lines

Posted on 2001-06-13
13
168 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Expert Comment

by:teacher_mod
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
I agree....give points to Ernest...

Max.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
Comment Utility
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
Comment Utility
Accepting Ernest's comment as answer
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)

744 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

18 Experts available now in Live!

Get 1:1 Help Now