add
This commit is contained in:
19
src/ui/DWBG9FB3/reportExport.js
Normal file
19
src/ui/DWBG9FB3/reportExport.js
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* 通过浏览器打印对话框导出 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user