Forum Bugs

page breaks and footers

PotentialCustomer
I am working on a proof of concept to see if PrinceXML has the features my company needs. I have run into a few issues and need some help.

1)
<br style="page-break-before:always;" />

Prince log says following
Unexpected end tag : br

In IE8 the above is rendered as a page break however PrinceXML seems to ignore it. I tried the following to see what would happen:
css
br.pagebreak{page-break-before:always;}

html
<br class="pagebreak" />

I didn't get the log warning but again it ignored the above code
what am I missing?

2)
<p>
    <ul >
        <li>somedata</li>
        <li>somedata</li>
    </ul>
</p>

Prince log showed following warning
Unexpected end tag : p

any idea why? it still rendered correctly, if I remove the list tags then it no longer warns me about p tag.
3)I am trying to figure a way to put a table into the footer of any page I need it, not all pages, a table like following
<table>
    <tr>
        <td>row1</td>
    </tr>
    <tr>
        <td>row2</td>
    </tr>
</table>

Haven't been able to figure out if Prince would support being able to add html tags into footer that would be properly rendered.
4)If i have the following css rule
@page { 
    @bottom {
	content: "Page " counter(page);
    }
}

it correctly displays the message at bottom of a page, if I wanted to be able to have it not show on some but show on others by just adding a tag with some class I tried the following
@page no_pagenum { 
    @bottom {
	content: " ";
    }
}

p.nopagenum{page: no_pagenum ;
	}

issue is that it would create a blank page with no page counter at bottom where ever I put a p tag with class nopagenum, I wanted to cause it not to show a page counter in whatever page box I had this particular tag. Any ideas?
StoneCypher
Unexpected end tag : br


Prince is a strict renderer. Check your doctype. I'm willing to bet it's HTML 4.01 strict. In that case, br has no end tag, so <br /> is technically incorrect. Either remove the XHTML/HTML5 style implicit empty, or change your doctype to match the code you're writing.

br.pagebreak{page-break-before:always;}

I didn't get the log warning but again it ignored the above code
what am I missing?


This is a historic detail of HTML and CSS. The short version is "br isn't a block-level element, and page-break-before requires a block. Make it display:block; and it will start working. IE8 is wrong. Check your work against Opera to get more similar results."

The long version is "the reason they didn't fix that is they don't expect you to add a break to a break. You're supposed to put that on the <h1> or the <p> or whatever directly, and ditch the <br>. Setting display:block on the <br> gets you out of the immediate circumstance but does not make you semantically correct. If you just need the job done, that's the way. If you need a long term maintainable system, do it right; it'll pay off."

Unexpected end tag : p


Doesn't happen here. Give us the surrounding context; it might be outside that block.

Haven't been able to figure out if Prince would support being able to add html tags into footer that would be properly rendered.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head/><body><div style="position: absolute; bottom: 0; left: 0; right: 0;"><table><tr><td style="border: 1px solid red">Yep</td><td>It</td></tr><tr><td>Works</td><td style="border: 1px solid green">Fine</td></tr></table></div></body></html>


if I wanted to be able to have it not show on some but show on others by just adding a tag with some class I tried the following


XML entity, bro.

I wanted to cause it not to show a page counter in whatever page box I had this particular tag.


How to do this is not immediately obvious to me. Maybe someone else will know.

John Haugeland is http://fullof.bs/

PotentialCustomer
StoneCypher wrote:


Thanks for your reply.
Haven't been able to figure out if Prince would support being able to add html tags into footer that would be properly rendered.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head/><body><div style="position: absolute; bottom: 0; left: 0; right: 0;"><table><tr><td style="border: 1px solid red">Yep</td><td>It</td></tr><tr><td>Works</td><td style="border: 1px solid green">Fine</td></tr></table></div></body></html>



I had tried something similar to this however this particular take will not work as the table text floats over exiting text on the page as opposed to being a true "footer". Like when you use @page rule @bottom it doesn't appear over the existing text but instead at bottom of the page.
mikeday
The </p> error is because in HTML you cannot nest lists (or tables, or any other block element) inside paragraphs. When the parser sees the <ol>, it implies that the paragraph finishes at that point, so the </p> later is a surprise. In XML this is still well-formed, just invalid according to the XHTML DTD. Better to wrap it up as a <div>, or split the paragraph into two <p> elements.

At the moment it is not possible to style the page that a particular element appears on unless that element is responsible for the page break.