在winform中reprot 无预览 可以直接report.print直接就打印了.而web端 使用前端打印 ,后端尽管也可以打印,只是那一般是在服务上了.于是乎实现无预览打印的机制就不一样了.

How to: Print a Report Without Displaying a Preview

https://docs.devexpress.com/eXpressAppFramework/113601/shape-export-print-data/reports/task-based-help/how-to-print-a-report-without-displaying-a-preview

例子页面

https://supportcenter.devexpress.com/ticket/details/t227361/reporting-for-asp-net-webforms-how-to-print-or-export-a-report-without-showing-a-preview

reporting-asp-net-core-print-without-preview

https://github.com/DevExpress-Examples/reporting-asp-net-core-print-without-preview

 

原理:
To print the report, export it to the PDF format. Then write the PDF stream to the page's Response with the Content-Disposition header set to the "inline" value.
The browser's built-in PDF viewer opens the PDF file. An alternative method exports the PDF to a separate iframe. In this case, only the print dialog is displayed.
大概意思是在服务器上编译成pdf流  返回到前端 ,前端会根据返回显示打印dialog.
posted on 2025-01-13 14:34  小石头的一天  阅读(45)  评论(0)    收藏  举报