@@ -194,6 +194,7 @@ export async function layoutHeaderFooterWithCache(
194194 cache : HeaderFooterLayoutCache = sharedHeaderFooterCache ,
195195 totalPages ?: number ,
196196 pageResolver ?: PageResolver ,
197+ kind ?: 'header' | 'footer' ,
197198) : Promise < HeaderFooterBatchResult > {
198199 const result : HeaderFooterBatchResult = { } ;
199200
@@ -211,7 +212,7 @@ export async function layoutHeaderFooterWithCache(
211212 resolveHeaderFooterTokens ( clonedBlocks , 1 , numPages ) ;
212213
213214 const measures = await cache . measureBlocks ( clonedBlocks , constraints , measureBlock ) ;
214- const layout = layoutHeaderFooter ( clonedBlocks , measures , constraints ) ;
215+ const layout = layoutHeaderFooter ( clonedBlocks , measures , constraints , kind ) ;
215216
216217 result [ type ] = { blocks : clonedBlocks , measures, layout } ;
217218 }
@@ -231,7 +232,7 @@ export async function layoutHeaderFooterWithCache(
231232 const hasTokens = hasPageTokens ( blocks ) ;
232233 if ( ! hasTokens ) {
233234 const measures = await cache . measureBlocks ( blocks , constraints , measureBlock ) ;
234- const layout = layoutHeaderFooter ( blocks , measures , constraints ) ;
235+ const layout = layoutHeaderFooter ( blocks , measures , constraints , kind ) ;
235236 result [ type ] = { blocks, measures, layout } ;
236237 continue ;
237238 }
@@ -275,7 +276,7 @@ export async function layoutHeaderFooterWithCache(
275276
276277 // Measure and layout
277278 const measures = await cache . measureBlocks ( clonedBlocks , constraints , measureBlock ) ;
278- const pageLayout = layoutHeaderFooter ( clonedBlocks , measures , constraints ) ;
279+ const pageLayout = layoutHeaderFooter ( clonedBlocks , measures , constraints , kind ) ;
279280 const measuresById = new Map < string , Measure > ( ) ;
280281 for ( let i = 0 ; i < clonedBlocks . length ; i += 1 ) {
281282 measuresById . set ( clonedBlocks [ i ] . id , measures [ i ] ) ;
@@ -307,13 +308,14 @@ export async function layoutHeaderFooterWithCache(
307308 // Construct final HeaderFooterLayout with all pages
308309 // Use the first page's measurements for overall dimensions
309310 const firstPageLayout = pages [ 0 ]
310- ? layoutHeaderFooter ( pages [ 0 ] . blocks , pages [ 0 ] . measures , constraints )
311+ ? layoutHeaderFooter ( pages [ 0 ] . blocks , pages [ 0 ] . measures , constraints , kind )
311312 : { height : 0 , pages : [ ] } ;
312313
313314 const finalLayout : HeaderFooterLayout = {
314315 height : firstPageLayout . height ,
315316 minY : firstPageLayout . minY ,
316317 maxY : firstPageLayout . maxY ,
318+ renderHeight : firstPageLayout . renderHeight ,
317319 pages : pages . map ( ( p ) => ( {
318320 number : p . number ,
319321 fragments : p . fragments ,
0 commit comments