Print feature handling
- Source:
- print.js
Methods
-
<static> addLogoStyles()
-
Add CSS styles for logo sizing in headers/footers
- Source:
- print.js
-
<static> addPaddingForLastPage(pageHeight, currentPage)
-
Add padding to the last page to ensure proper scroll positioning
Parameters:
Name Type Description pageHeightnumber The page height
currentPagenumber The current page index
- Source:
- print.js
Returns:
Updated document height
- Type
- number
-
<static> addScrollBehaviorOverride()
-
Add CSS override to disable scroll-behavior during PDF export This prevents pagination issues where smooth scrolling causes content to be captured at the wrong scroll position
- Source:
- print.js
-
<static> adjustHeaderFooterHeight()
-
Dynamically adjust header/footer height based on logo dimensions
- Source:
- print.js
-
<static> buildHeadingHierarchyCache(pages)
-
Build heading hierarchy cache for all pages during pagination
Parameters:
Name Type Description pagesArray Array of page elements from pagination
- Source:
- print.js
-
<static> checkIfHeadingIsOrphaned(headingElement, pageEnd, contentAreaHeight)
-
Check if a heading is orphaned (no content below it on the same page)
Parameters:
Name Type Description headingElementElement The heading element to check
pageEndnumber The end position of the current page
contentAreaHeightnumber The height of the content area
- Source:
- print.js
Returns:
True if the heading is orphaned
- Type
- boolean
-
<static> clearHeadingHierarchyCache()
-
Clear the heading hierarchy cache
- Source:
- print.js
-
<static> createFootnoteContainer(pageFootnotes)
-
Create a single footnote container
Parameters:
Name Type Description pageFootnotesArray Array of footnotes for this page
- Source:
- print.js
Returns:
The footnote container element
- Type
- Element
-
<static> createFootnoteContainers(footnotes, contentAreaHeight)
-
Create footnote containers and insert them into the DOM
Parameters:
Name Type Description footnotesArray Array of footnote objects
contentAreaHeightnumber Height of the content area
- Source:
- print.js
-
<static> debugPageContent(pageIndex, pageHeight)
-
Debug function to analyze content positioning and help identify pagination issues
Parameters:
Name Type Description pageIndexnumber The page index to analyze
pageHeightnumber The page height
- Source:
- print.js
Returns:
Analysis results
- Type
- object
-
<static> extractFootnotes()
-
Extract footnotes from the document
- Source:
- print.js
Returns:
Array of footnote objects
- Type
- Array
-
<static> getCurrentHeadingHierarchy(pageNumber, pageOffset)
-
Get current heading hierarchy based on page position
Parameters:
Name Type Description pageNumbernumber Current page number (1-based)
pageOffsetnumber Optional page offset for print context
- Source:
- print.js
Returns:
Object with h1, h2, h3 properties containing current heading text
- Type
- object
-
<static> getUpdatedDocumentHeight()
-
Get the updated document height after pagination
- Source:
- print.js
Returns:
Updated document height
- Type
- number
-
<static> handleWatchedHeadings(pageIndex, contentAreaHeight, movedElements)
-
Handle headings that were marked for watching after their next elements were moved
Parameters:
Name Type Description pageIndexnumber The current page index
contentAreaHeightnumber The height of the content area
movedElementsSet Set of elements that have already been moved
- Source:
- print.js
-
<static> isPageEmpty(pageIndex, pageHeight)
-
Check if a page is truly empty (has no meaningful content)
Parameters:
Name Type Description pageIndexnumber The page index to check
pageHeightnumber The page height
- Source:
- print.js
Returns:
True if the page is empty
- Type
- boolean
-
<static> makeBandW(bool, format, critic)
-
Set page up for printing, removing color and extra elements
Parameters:
Name Type Description boolstring Do or undo BandW
formatstring The file format to prepare for
criticstring CriticMarkup type
- Source:
- print.js
Returns:
Success string
- Type
- string
-
<static> paginateEntireDocument(paginationBuffer, contentAreaHeight)
-
Complete pagination function that handles the entire document
Parameters:
Name Type Description paginationBuffernumber Buffer for determining cutoff points
contentAreaHeightnumber Height of the content area
- Source:
- print.js
Returns:
Total number of pages after pagination
- Type
- number
-
<static> positionFootnoteContainers(contentAreaHeight)
-
Position footnote containers at the bottom of their respective pages
Parameters:
Name Type Description contentAreaHeightnumber Height of the content area
- Source:
- print.js
-
<static> preparePrintOperation(printing, critic, callback)
-
Prepare for print operation
Parameters:
Name Type Description printingboolean | string Is printing
criticboolean | string CriticMarkup mode
callbackfunction Callback function
- Source:
- print.js
-
<static> preventOrphanedHeadings(pageIndex, contentAreaHeight, movedElements)
-
Proactively check and move orphaned headings to prevent them from being the last element on a page
Parameters:
Name Type Description pageIndexnumber The current page index
contentAreaHeightnumber The height of the content area
movedElementsSet Set of elements that have already been moved
- Source:
- print.js
-
<static> printPrepared()
-
Default callback function
- Source:
- print.js
-
<static> processConditionalSeparators(input, headings)
-
Process conditional separators in header/footer templates
Parameters:
Name Type Description inputstring String containing %sep() tokens
headingsobject Current heading hierarchy
- Source:
- print.js
Returns:
String with processed separators
- Type
- string
-
<static> processFootnotesForCurrentPage()
-
Process footnotes for placement at the bottom of pages
- Deprecated:
-
- This function is no longer used - footnote processing now happens after pagination
- Source:
- print.js
-
<static> refreshHeaderFooterFontPreferences()
-
Refresh header/footer font preferences (useful when preferences change)
- Source:
- print.js
-
<static> resetHeaderFooterHeight()
-
Reset header/footer height when logo is removed
- Source:
- print.js
-
<static> resetPagination()
-
Reset pagination state (clear moved elements tracking)
- Source:
- print.js
-
<static> setCustomHeaderFooterHeight(height)
-
Set custom header/footer height (useful for manual overrides)
Parameters:
Name Type Description heightstring Height value (e.g., "2em", "40px")
- Source:
- print.js
-
<static> setHeaderFooterFontPreferences()
-
Set header/footer font preferences and calculate proper height
- Source:
- print.js
-
<static> splitTableAtPage(table, pageEnd)
-
Split a table at page boundary by finding the last row that fits on the current page and adding padding-top to the next row to push it to the next page.
Parameters:
Name Type Description tableHTMLElement The table element to split
pageEndnumber The page boundary position (absolute Y)
- Source:
- print.js
Returns:
Result object with split: true/false and details
- Type
- Object
-
init()
-
Initialize print variables
- Source:
- print.js
-
processVariables(input, opt)
-
Replace print header/footer variables
Parameters:
Name Type Description inputstring String containing variables tokens
optobject Options
- Source:
- print.js
Returns:
String with replaced variables
- Type
- string