Files
report_viewer/src/ui/DWBG9FB3/reportExport.js
2026-06-10 12:22:43 +08:00

20 lines
559 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 通过浏览器打印对话框导出 PDF目标打印机选「另存为 PDF」
* 零依赖,适合当前纯前端报告查看器;复杂图表场景可改用服务端渲染 PDF。
*/
export async function printReportAsPdf(reportElement) {
if (!reportElement) return;
document.body.classList.add('dwbg9fb3-printing');
await new Promise((resolve) => requestAnimationFrame(resolve));
try {
window.print();
} finally {
window.setTimeout(() => {
document.body.classList.remove('dwbg9fb3-printing');
}, 500);
}
}