Hey, 1. how can we print a table enclose to the fo...
# general
j
Hey, 1. how can we print a table enclose to the footer dynamic in advanced pdf template? 2. How can we print message in the last page of the footer in advanced pdf template ? Appreciate your help!
p
Not sure I understand exactly what you mean but the below adds header and footer to your body using macro-tag:
Copy code
<macrolist>
<macro id="nlheader">
<p>
<div width="60%" float="left" clear="none">
<table width="100%">
<tr>
<td><#if subsidiary.logo?has_content><div top="-20"><img src="${subsidiary.logo@url}"  style="width: 135px; height: 45px;" /></div></#if></td>
</tr>
</table>
</div>
<div width="40%" float="left" clear="right">
<table width="100%">
<tr>
<td width="55%"><p align="left" style="font-size: 10pt; margin-right: 7px; text-transform: uppercase; color: #373D3F;"><b>${record.title}</b></p></td>
<td><p style="font-size: 8pt; text-align: right;">Page <pagenumber/> / <totalpages/></p></td>
</tr>
</table>
</div>
</p>
</macro>
<macro id="nlfooter">
<table width="100%" style="padding: 0px; margin-left: 0px;" float="left" clear="none">
<tr>
<td>
<!-- Footer data here -->
</td>
</tr> 
</table>
</macro>
</macrolist>

<!-- Then add this to body-tag: -->

<body header="nlheader" header-height="xx%" footer="nlfooter" footer-height="xx%" size="A4">
</body>
That footer will show up on every page and page-breaks will be automatic. You can add whatever in the footer, having something only on last page could just be added last in the body tag, unless you really want to change the footer (why? what use case?)
j
@PWN Thanks for your information, Here I don't want to print same message on every page . we have to print a message only on last page.
p
I don't think that can be done in Freemarker as you cannot as far as I know set the page number in variable and check for its value, you can do it with regular html/css though - quick stack overflow search provides something like this (I have no idea if it works, in either case not a Netsuite-specific thing):
Copy code
*{/* those only to remove margins */
  margin:0;
  padding:0;
  box-sizing:border-box;
}
html,body{/* make sure to give html and body 100% height */
  height:100%;
}
.container{
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  height: calc(100% - 45px); /* 100% - footer height (thats the available space)*/
  /* Change the 45px to the footer height */
}
footer{/* footer sample */
  height:45px;
  background-color:#223;
  color:#fff;
}
<html>
<body>
<div class="container">
<table class="body" style="width: 100%; margin-top: 10px;">
    <td><#--- Body table ---></td>
</table>

<table class="recap">
    <td><#--- Table to keep at the bottom ---></td>
</table>
</div>
<footer>This is the footer</footer>
</body>
</html>
j
@PWN Yes I tried, Nonetheless it is not working. I am not sure what is the issue.
p
do you have any conflicting css maybe? position: fixed e.g. would for sure break the dynamic part.
Also, dont do this in netsuite, get the html working in a browser, use e.g. Chrome dev console to trouble shoot etc. then add it to PDF template
j
Yes, It is working on html on dev console but in NS it is not working.
position: fixed , this is not supporting in advanced pdf template directly in the <div>