Counting Lines of Rendered HTML?

Discussion in 'HTML' started by travismcmahan, Jun 7, 2006.

  1. 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!
    travismcmahan, Jun 7, 2006
    #1
    1. Advertising

  2. 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
    Adrienne Boswell, Jun 7, 2006
    #2
    1. Advertising

  3. I appreciate your response, however block elements like <table>, <div>,
    <p> cause problems with that sort of approach.
    travismcmahan, Jun 7, 2006
    #3
  4. travismcmahan

    Toby Inkster Guest

    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
    Toby Inkster, Jun 8, 2006
    #4
  5. 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
    Blinky the Shark, Jun 8, 2006
    #5
  6. travismcmahan

    Jim Moe Guest

    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)
    Jim Moe, Jun 8, 2006
    #6
  7. Gazing into my crystal ball I observed "travismcmahan" <>
    writing in news::

    > 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
    Adrienne Boswell, Jun 8, 2006
    #7
  8. travismcmahan

    Andy Dingley Guest

    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)
    Andy Dingley, Jun 8, 2006
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mikester
    Replies:
    7
    Views:
    592
    mikester
    Dec 25, 2003
  2. Davidd Sargent

    Help with counting lines?

    Davidd Sargent, Aug 13, 2004, in forum: Perl
    Replies:
    3
    Views:
    440
    Gunnar Hjalmarsson
    Aug 13, 2004
  3. j
    Replies:
    1
    Views:
    732
    Kevin Spencer
    Jul 22, 2003
  4. Ciba LO
    Replies:
    4
    Views:
    176
    Ciba LO
    Jul 8, 2006
  5. edwardfredriks

    counting up instead of counting down

    edwardfredriks, Sep 6, 2005, in forum: Javascript
    Replies:
    6
    Views:
    188
    Dr John Stockton
    Sep 7, 2005
Loading...

Share This Page