Forum Bugs

Not printing footer

huber.espinoza
Hi there.

We have an issue related to footer, it was working on the older version but after we upgraded to version 10 it quit working.

See css which worked on older version:
.HwPrintFooter
{
margin: 0;
padding: 0;
max-height: none;
overflow: visible;
position: relative;
}
.HwPrintFooter img
{
display: block;
float: bottom;
margin-bottom: -1in;
}

@page {
size: US-Letter;
margin-top: 36pt;
margin-right: 0;
margin-bottom: 0;
margin-left: 0;
}
* { prince-link: none ! important }

Then we found that removing next lines, footer appears, but not right at the bottom.

float: bottom;
margin-bottom: -1in;

To fix it I added next css code to .HwPrintFooter

flow: static(footer, current);

and

@bottom-left-corner {
margin-bottom: -1px;
content: flow(footer);
}


Result:

<?xml version="1.0" encoding="utf-8"?>
<html >
<head>
<style type="text/css">
@page
{
margin-bottom: 1in !important;
font-family: verdana;
font-size: 11px;
}
.HwPrintDocumentWrapper
{
width: 6.5in;
}
#HwTableWrapper
{
margin: 0;
}
#HwTBody
{
display: block;
}
#HwCoverPage
{
margin-left: 1in;
margin-right: 1in;
}

#HwFormsAppendixHeader
{
margin-left: 1in;
margin-right: 1in;
}
.HwPrintHeader
{
margin: 0;
padding: 0;
height: auto;
margin-top: -50px;
margin-left: -2px;
position: relative;
top: auto;
left: auto;
}
.HwPrintFooterWrapper
{
margin: 0;
padding: 0;
}
.HwPrintFooter
{
margin: 0;
padding: 0;
max-height: none;
overflow: visible;
position: relative;
flow: static(footer, current);
}
.HwPrintFooter img
{
display: block;

}
#HwOuterPrintWrapper
{
margin-top: 0px;
margin-left: 1in;
margin-right: 1in;
}

</style>
<style type="text/css">
@page {
size: US-Letter;
margin-top: 36pt;
margin-right: 0;
margin-bottom: 0;
margin-left: 0;

@bottom-left-corner {
margin-bottom: -1px;
content: flow(footer);
}
}
* { prince-link: none ! important }
</style>
</head>
<body style="font-size:12pt">
<table id="HwTableWrapper" class="HwElement">
<thead id="HwTHead">
<tr>
<td>
<div class="HwPrintHeader HwPrintHeaderRepeatAll">
<div id="IxHeaderWrapper">
<div id="IxHeaderImage">
<img src="http://rtfq.net/wp-content/uploads/2012/02/header.png" />
</div>
<div id="IxHeaderTextWrapper"/>
</div>
</div>
</td>
</tr>
</thead>
<tfoot id="HwTFoot">
<tr>
<td>
<div class="HwPrintFooterWrapper">
<div class="HwPrintFooter HwPrintFooterRepeatAll">
<div id="IxClientDisclaimerWrapper">
<div id="IxClientDisclaimerTextWrapper"/>
<div id="IxClientDisclaimerImage">
<img src="http://dhruvacademy.com/footer.png" />
</div>
</div>
</div>
</div>
</td>
</tr>
</tfoot>
<tbody id="HwTBody">
<tr>
<td>
<div id="HwCoverPage">
<!-- cover page can go here -->
</div>
<div id="HwOuterPrintWrapper">
<!-- multiple docTemplates can go here -->
</div>
<div id="HwFormsAppendixHeader">
<!-- appendix can go here -->
</div>
</td>
</tr>
</tbody>
</table>
</body>
</html>

PD: Header and Footer images are just samples.

All works when we compile it on command prompt, but when we run through the app it doesn't. What can be wrong?
mikeday
Hmm I'm not sure where to start. Are you using the same version of Prince on the command line and through your own application?

This empty div element looks suspicious:
<div id="IxClientDisclaimerTextWrapper"/>

This will work in XML, but HTML will treat it as a start tag and ignore the trailing slash, then match it up with a </div> close tag. If the document is being processed as HTML then this may cause problems.
huber.espinoza
Yes, It's the same version, I took it from my solucion and ran it on command line. There shouldn't be differences between create pdf on my solution and command line, but footer disappears on my solution even when xml are exactly the same.

I'll take a look at the IxClientDisclaimerTextWrapper div. That's interesting!.

Thanks!
huber.espinoza
I've fixed the markup possible issues, but still no printing footer on my application. Why adding flow: static doesn't work on .NET and footer disappears?

<?xml version="1.0" encoding="utf-8"?>
<html >
<head>
	<style type="text/css">
@page 
{
    margin-bottom: 1in !important;
    font-family: verdana;
    font-size: 11px; 
}
.HwContent .HwGoToWeb
{
    display: none !important;
}
.HwPrintDocumentWrapper
{
    width: 6.5in;
}
#HwTableWrapper
{
    margin: 0;    
}
#HwTBody
{
    display: block;
}
#HwCoverPage
{
    margin-left: 1in;
    margin-right: 1in;
}
#HwCoverPageTextWrapper
{
    padding-top: 10px;
}
#HwFormsAppendixHeader
{
    margin-left: 1in;
    margin-right: 1in;
}
.HwPrintHeader
{
    margin: 0;
    padding: 0;
    height: auto;
    margin-top: -50px;
    margin-left: -2px;
    position: relative;
    top: auto;
    left: auto;
}
.HwPrintFooterWrapper
{
    margin: 0;
    padding: 0;
}
.HwPrintFooter
{
    margin: 0;
    padding: 0;
    max-height: none;
    overflow: visible;
    position: relative;
    flow: static(footer, current);
}
.HwPrintFooter img
{
    display: block;
    
}
#HwOuterPrintWrapper
{
    margin-top: 0px;
    margin-left: 1in;
    margin-right: 1in;
}
.HwPrintHeaderRepeatDocument
{
    margin-left: -100px !important;
    margin-right: -100px !important;
    margin-top: -54px !important;
}
.HwPrintHeaderRepeatFirst
{
    margin-top: -52px !important;
    margin-left: -4px !important;
    margin-right: -5px !important;
}</style><style type="text/css">
@page {
    size: US-Letter;
    margin-top: 36pt;
    margin-right: 0;
    margin-bottom: 0;
    margin-left: 0;

    @bottom-left-corner {
		margin-bottom: -1px;
		content: flow(footer);
	}
}
* { prince-link: none ! important } 
</style></head>
    <body style="font-size:12pt">
        <table id="HwTableWrapper" class="HwElement">
            <thead id="HwTHead">
                <tr>
                  <td>
                    <div class="HwPrintHeader HwPrintHeaderRepeatAll">
					<div id="IxHeaderWrapper">
						<div id="IxHeaderImage">
							<img src="http://lishufen.com/image/563a3e1103bfe.jpg" />
						</div>
					<div id="IxHeaderTextWrapper"></div>
				</div>
			</div>
                  </td>
                </tr>
            </thead>
            <tfoot id="HwTFoot">
                <tr>
                  <td>
                    <div class="HwPrintFooterWrapper">
                        <div class="HwPrintFooter HwPrintFooterRepeatAll">
				<div id="IxClientDisclaimerWrapper">
					<div id="IxClientDisclaimerTextWrapper"></div>
					<div id="IxClientDisclaimerImage">
						<img src="http://dhruvacademy.com/footer.png" />
					</div>
				</div>
			</div>
                    </div>
                  </td>
                </tr>
            </tfoot>
            <tbody id="HwTBody">
		<tr>
			<td>
				<div id="HwCoverPage"> 
					<!-- cover page can go here -->
				</div>
				<div id="HwOuterPrintWrapper">
					<!-- multiple docTemplates can go here -->
				</div>	
				<div id="HwFormsAppendixHeader">
					<!-- appendix can go here -->
				</div>
			</td>
		</tr>
	</tbody>
        </table>
    </body>
</html>


mikeday
You have specified zero margin-bottom for the page, this may be causing issues. Are you getting different results when you convert from .NET than from the command-line?
huber.espinoza
Yes, converting from .NET footer is not displayed, but from command-line it does. The weird thing is that when I got the exactly xml from .NET and ran it over command-line footer is printed as expected. I'm adding some other css files to the object in .NET, I was thinking some of them could be affecting the footer, but again on command-line all works.

Footer started disappearing in .NET after I removed float: bottom, margin-bottom: -1in and added flow: static(footer, current), content: flow(footer)
mikeday
Have you tried adding some margin-bottom to the @page? Results will not be reliable if you have a footer with zero margin.
huber.espinoza
Yes, I tried that! And there isn't changes, footer still no displayed in .NET.

 margin-bottom: 36pt; 
mikeday
Are you getting any error or warning messages from Prince when you run it under .NET? Are images loading?
huber.espinoza
Yes, all images are loaded except footer. I don't see errors or warnings, all looks good in .NET