Forum How do I...?

Only first page of HTML file is generated to PDF

dougkramer
When I run this command:
$ /home/doog/bin/prince/prince-7.0b1/prince -i html -o test.pdf Google_Checkout_Basic_HTML_How_Checkout_Works.html

on this web page:
http://code.google.com/apis/checkout/developer/Google_Checkout_Basic_HTML_How_Checkout_Works.html

I get a one-page PDF file that produces only the first page of the HTML file (wish I could attach it).

It generates these errors:
673: error: Opening and ending tag mismatch: li and div
675: error: Opening and ending tag mismatch: ul and div

I haven't traced these errors yet (they're in the left menu which appears only in the HTML, and are excluded from the PDF). What other likely suspects would prevent the subsequent pages from printing?
mikeday
Is the whole page inside an absolutely positioned block?
dougkramer
There are no blocks or elements that define a page.

But just to make sure nothing absolute was interfering... It took me a while to analyze all the CSS -- there were 4 styles that had "position:absolute" in them. I commented all of these out and I get the same results. It still generates only the first page.

I suppose I could start removing elements from the page until I get it to render all pages?
mikeday
It is due to the "height: 100%" rule applied to the html and body elements inside codesite.pack.04102009.css, within an @media rule. Making the root element the same height as the viewport makes sense in a browser, as the viewport expands infinitely to contain the document. It's more complicated for paged media where there is no scrolling, and currently in Prince specifying an explicit height inhibits an element from breaking across pages.
dougkramer
Thanks! Removing "height: 100%" did it. It prints all pages — I just generated a 1212 page PDF file.

I'm not so familiar with height in its uses. You say it makes sense in a browser. What effect does it have in browers? Does it set the location of elements from the bottom of the viewport?

Might it make sense to define height: 100% for screen but not projection and print?

@media screen,projection,print {
html,body {height:100%;margin:0;padding:0}

Thanks so much. Now I can proceed to refine the pages. The whole page is shifted right — the left margin too big, right margin too small.

BTW, I haven't read the license yet. Can we publish pages with the Prince logo in the upper right corner without purchasing a copy of Prince? (We plan to purchase it.)
mikeday
Specifying an absolute height allows children elements to have a height that is a percentage of that. It shouldn't affect positioning as far as I'm aware.

The Opera browser supports @media projection I believe in slideshow mode, so you could try that with the height property and see if it's necessary or helpful.

You can publish documents created with the Personal License that include the Prince logo in the corner. If you find Prince useful, we would certainly recommend purchasing a license in order to support the further development of the product.