Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Counting Lines of Rendered HTML?

Reply
Thread Tools

Counting Lines of Rendered HTML?

 
 
travismcmahan
Guest
Posts: n/a
 
      06-07-2006
Hello,

I am working on a project that requires me to paginate a dynamic length
html document so I can then in turn send each page to a PDF conversion
component. I have been researching for an hour now and have yet to
come across a solution.

The data I am dealing with is a string with embedded html. I need to
determine how many lines the rendered output will use in a browser so I
can issue a page break appropriately.

Any suggestions? Thanks in advance!

 
Reply With Quote
 
 
 
 
Adrienne Boswell
Guest
Posts: n/a
 
      06-07-2006

travismcmahan wote:
> Hello,
>
> I am working on a project that requires me to paginate a dynamic length
> html document so I can then in turn send each page to a PDF conversion
> component. I have been researching for an hour now and have yet to
> come across a solution.
>
> The data I am dealing with is a string with embedded html. I need to
> determine how many lines the rendered output will use in a browser so I
> can issue a page break appropriately.
>
> Any suggestions? Thanks in advance!


You could perhaps do something with characters. When 70 characters are
reached, you might have a line break, so you could calculate from that.

--
Adrienne Boswell at work
http://atlas.nextblock.com/files/
Please respond to the group so others can share

 
Reply With Quote
 
 
 
 
travismcmahan
Guest
Posts: n/a
 
      06-07-2006
I appreciate your response, however block elements like <table>, <div>,
<p> cause problems with that sort of approach.

 
Reply With Quote
 
Toby Inkster
Guest
Posts: n/a
 
      06-07-2006
travismcmahan wrote:

> The data I am dealing with is a string with embedded html. I need to
> determine how many lines the rendered output will use in a browser so I
> can issue a page break appropriately.


How big is your font? How wide is your browser window?

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

 
Reply With Quote
 
Blinky the Shark
Guest
Posts: n/a
 
      06-08-2006
Toby Inkster wrote:

> How big is your font? How wide is your browser window?


That sounds like dirty talk to me. The next thing you'll be asking is
"what are you wearing?"


--
Blinky RLU 297263
Killing all posts from Google Groups
The Usenet Improvement Project: http://blinkynet.net/comp/uip5.html
Coming Soon: Filtering rules specific to various real news clients
 
Reply With Quote
 
Jim Moe
Guest
Posts: n/a
 
      06-08-2006
travismcmahan wrote:
>
> I am working on a project that requires me to paginate a dynamic length
> html document so I can then in turn send each page to a PDF conversion
> component. I have been researching for an hour now and have yet to
> come across a solution.
>
> The data I am dealing with is a string with embedded html. I need to
> determine how many lines the rendered output will use in a browser so I
> can issue a page break appropriately.
>

I guess you are limiting yourself to GUI browsers? There are also text
browsers, speech browsers, search engines, etc.
Browsers render HTML within the constraints set by both the user and the
author, and the browser's own limitations. How would you resolve all of
the visual variables to decide what the actual rendering is?

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
 
Reply With Quote
 
Adrienne Boswell
Guest
Posts: n/a
 
      06-08-2006
Gazing into my crystal ball I observed "travismcmahan" <(E-Mail Removed)>
writing in news:(E-Mail Removed) oups.com:

> I appreciate your response, however block elements like <table>, <div>,
><p> cause problems with that sort of approach.
>


Then you make allowances for that in your script. If you get a tag, find
out which element it is, account for it, get the text, then look for the
ending tag.

If the element is a block level element, allow 1 line for it. Then you have
a count of the characters in the text between the element tags.
--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

 
Reply With Quote
 
Andy Dingley
Guest
Posts: n/a
 
      06-08-2006

travismcmahan wrote:

> I am working on a project that requires me to paginate a dynamic length
> html document so I can then in turn send each page to a PDF conversion
> component.


Don't paginate HTML, it sucks at doing it. HTML has no concept of
pages, and the CSS that does isn't well or widely supported.

You'd be better looking at taking your HTML into XML and XSL:FO, then
controlling the pagination in XSL:FO (which is good at it). XSL:FO to
PDF is trivial (lots of tools already around for it - look at Apache
Fop)

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
counting up instead of counting down edwardfredriks Javascript 6 09-07-2005 03:30 PM
Counting lines of text. Brent ASP .Net 3 02-18-2005 08:29 AM
Help with counting lines? Davidd Sargent Perl 3 08-13-2004 02:30 PM
counting matched lines in extremely large files. mikester Perl 7 12-25-2003 02:21 PM
Counting lines/characters in an uploaded .DOC/.RTF file using ASP.NET j ASP .Net 1 07-22-2003 06:23 PM



Advertisments