ANS-1613 · PRINTING, PDF & EMAIL TEMPLATES
How to Display Page Numbers and Total Pages in NetSuite Advanced PDF/HTML Templates
Learn to use BFO tags like <pagenumber/> and <totalpages/> to manage page numbering and references within NetSuite's Advanced PDF/HTML documents.
Short answer
NetSuite Advanced PDF/HTML Templates utilize BFO tags for page numbering. Use <pagenumber/> for the current page, <pagenumber idref='yourid'/> to reference a specific section's page, and <totalpages/> to display the document's total page count. Ensure correct tag placement within your template for accurate rendering.
Scenario
Users often need to include dynamic page numbering, such as 'Page X of Y', or reference the page number of specific sections within their NetSuite Advanced PDF/HTML documents. Achieving this requires understanding the correct application of BFO (Big Faceless Organization) tags for page breaks and page number referencing.
Solution
NetSuite's Advanced PDF/HTML Templates leverage BFO tags to manage page numbering and breaks. The element is versatile, allowing display of the current page number or referencing the page number of other elements in the document, which is particularly useful for tables of contents or cross-references.To implement advanced page numbering:
To force a page break at a specific point in the document, use the tag.
Assign a unique id attribute to the closing tag of the section whose page number needs to be referenced. This is typically the end of a dynamic table or a specific content block. For example:
html< div id"pagenumbers'+transactionRecord.getId()+'">< /div >To display the page number of a referenced section, use the tag with the idref attribute, pointing to the id assigned in the previous step. For instance, to reference the page number of the section identified by pagenumbers'+transactionRecord.getId()+'':
html< pagenumber idref"pagenumbers'+transactionRecord.getId()+'"/>To display the total number of pages in the document, use the tag directly within your template. This tag is processed by the BFO engine to output the final page count.It is important to note that BFO elements like and are processed by the BFO engine after FreeMarker has completed its processing. Therefore, their rendered values are not directly available for FreeMarker's conditional logic or direct assignment.
Expert NetSuite Support
Need help with this NetSuite issue?
Printing, PDF & Email Templates consulting and configuration support
