Ok, I found the related source code as below.
ExecuteScript() seem to call some blink functions.
Problem seems to with the blink but without deep understanding of the blink, this only a guess at this point.
Need the expert help at this point.
chromium\src\components\printing\renderer\print_render_frame_helper.cc
const char kPageSetupScriptFormat[] = "setupHeaderFooterTemplate(%s);";
void PrintRenderFrameHelper::PrintHeaderAndFooter()
{
..........
ExecuteScript(frame, kPageSetupScriptFormat, *options);
blink::WebPrintParams webkit_params(page_size);
webkit_params.printer_dpi = GetDPI(params);
frame->PrintBegin(webkit_params, blink::WebNode());
frame->PrintPage(0, canvas);
frame->PrintEnd();
}
chromium\src\third_party\blink\renderer\core\frame\web_local_frame_impl.cc